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.
This commit is contained in:
Germano Cavalcante 2022-11-06 10:14:53 -03:00
parent cad897de16
commit b2db324f60
1 changed files with 1 additions and 6 deletions

View File

@ -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;
}