From 0c318c4a476e013ffedf7786ec77e492352d0bcb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 4 May 2012 16:38:11 +0000 Subject: Fix (harmless) uninitialized memory usage in BVH binning. Fix unneeded warnings with c++ guardedalloc, delete NULL is valid. --- intern/cycles/bvh/bvh_binning.cpp | 1 + intern/guardedalloc/cpp/mallocn.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/intern/cycles/bvh/bvh_binning.cpp b/intern/cycles/bvh/bvh_binning.cpp index 661541a8d23..e4b88584a33 100644 --- a/intern/cycles/bvh/bvh_binning.cpp +++ b/intern/cycles/bvh/bvh_binning.cpp @@ -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 */ diff --git a/intern/guardedalloc/cpp/mallocn.cpp b/intern/guardedalloc/cpp/mallocn.cpp index 97e68d06ace..130fcb6960b 100644 --- a/intern/guardedalloc/cpp/mallocn.cpp +++ b/intern/guardedalloc/cpp/mallocn.cpp @@ -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); } -- cgit v1.2.3