Fix (harmless) uninitialized memory usage in BVH binning.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 4 May 2012 16:38:11 +0000 (16:38 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 4 May 2012 16:38:11 +0000 (16:38 +0000)
Fix unneeded warnings with c++ guardedalloc, delete NULL is valid.

intern/cycles/bvh/bvh_binning.cpp
intern/guardedalloc/cpp/mallocn.cpp

index 661541a8d231966d3302786e30cdf273e06d71e3..e4b88584a33c9290b32501f2a32cbb8ee094dac3 100644 (file)
@@ -122,6 +122,7 @@ BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
                bx = merge(bx,bin_bounds[i][0]); r_area[i][0] = bx.half_area();
                by = merge(by,bin_bounds[i][1]); r_area[i][1] = by.half_area();
                bz = merge(bz,bin_bounds[i][2]); r_area[i][2] = bz.half_area();
+               r_area[i][3] = r_area[i][2];
        }
 
        /* sweep from left to right and compute SAH */
index 97e68d06ace6ef1111536614b27bfcf14c99b891..130fcb6960bd5a62d27fac4caabba093284066ac 100644 (file)
@@ -41,5 +41,7 @@ void* operator new (size_t size, const char *str)
 
 void operator delete (void *p)
 {
-       MEM_freeN(p);
+       /* delete NULL is valid in c++ */
+       if(p)
+               MEM_freeN(p);
 }