[Bf-blender-cvs] [9ea82ce653c] blender-v3.4-release: Fix potentially uninitialized memory usage

Germano Cavalcante noreply at git.blender.org
Mon Nov 7 12:45:23 CET 2022


Commit: 9ea82ce653c87ad96ecbc4ca01c59eb6a3280fd1
Author: Germano Cavalcante
Date:   Sun Nov 6 10:14:53 2022 -0300
Branches: blender-v3.4-release
https://developer.blender.org/rB9ea82ce653c87ad96ecbc4ca01c59eb6a3280fd1

Fix potentially uninitialized memory usage

`nearest_world_tree_co` allows null parameter, so the `index` variable
isn't really needed and doesn't even need to be initialized.

===================================================================

M	source/blender/editors/transform/transform_snap_object.cc

===================================================================

diff --git a/source/blender/editors/transform/transform_snap_object.cc b/source/blender/editors/transform/transform_snap_object.cc
index a75a94803f7..2fab789afca 100644
--- a/source/blender/editors/transform/transform_snap_object.cc
+++ b/source/blender/editors/transform/transform_snap_object.cc
@@ -1187,14 +1187,13 @@ static bool nearest_world_tree(SnapObjectContext * /*sctx*/,
 
   float co_local[3];
   float no_local[3];
-  int index;
 
   copy_v3_v3(co_local, init_co_local);
 
   for (int i = 0; i < params->face_nearest_steps; i++) {
     add_v3_v3(co_local, delta_local);
     nearest_world_tree_co(
-        tree, nearest_cb, treedata, co_local, co_local, no_local, &index, nullptr);
+        tree, nearest_cb, treedata, co_local, co_local, no_local, r_index, nullptr);
   }
 
   mul_v3_m4v3(r_loc, obmat, co_local);
@@ -1204,10 +1203,6 @@ static bool nearest_world_tree(SnapObjectContext * /*sctx*/,
     normalize_v3(r_no);
   }
 
-  if (r_index) {
-    *r_index = index;
-  }
-
   return true;
 }



More information about the Bf-blender-cvs mailing list