[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46289] trunk/blender/intern: Fix ( harmless) uninitialized memory usage in BVH binning.

Brecht Van Lommel brechtvanlommel at pandora.be
Fri May 4 18:38:11 CEST 2012


Revision: 46289
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46289
Author:   blendix
Date:     2012-05-04 16:38:11 +0000 (Fri, 04 May 2012)
Log Message:
-----------
Fix (harmless) uninitialized memory usage in BVH binning.
Fix unneeded warnings with c++ guardedalloc, delete NULL is valid.

Modified Paths:
--------------
    trunk/blender/intern/cycles/bvh/bvh_binning.cpp
    trunk/blender/intern/guardedalloc/cpp/mallocn.cpp

Modified: trunk/blender/intern/cycles/bvh/bvh_binning.cpp
===================================================================
--- trunk/blender/intern/cycles/bvh/bvh_binning.cpp	2012-05-04 16:29:41 UTC (rev 46288)
+++ trunk/blender/intern/cycles/bvh/bvh_binning.cpp	2012-05-04 16:38:11 UTC (rev 46289)
@@ -122,6 +122,7 @@
 		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 */

Modified: trunk/blender/intern/guardedalloc/cpp/mallocn.cpp
===================================================================
--- trunk/blender/intern/guardedalloc/cpp/mallocn.cpp	2012-05-04 16:29:41 UTC (rev 46288)
+++ trunk/blender/intern/guardedalloc/cpp/mallocn.cpp	2012-05-04 16:38:11 UTC (rev 46289)
@@ -41,5 +41,7 @@
 
 void operator delete (void *p)
 {
-	MEM_freeN(p);
+	/* delete NULL is valid in c++ */
+	if(p)
+		MEM_freeN(p);
 }




More information about the Bf-blender-cvs mailing list