Fix T80561: Crash when multi-mesh editing UVs with proportional editing

Because of a `goto` we would free a variable before it was declared.
Declare it before the `goto` and `NULL`-check the value before freeing.
This commit is contained in:
Julian Eisel 2020-09-07 16:14:58 +02:00
parent d71458d919
commit 9681708c1c
Notes: blender-bot 2023-02-14 00:13:36 +01:00
Referenced by issue #80899, Crash on editing multiple UVs of multiple different objects at the same time
Referenced by issue #80561, Crashing when I alter UVs in multi-mesh editing (using proportional editing)
Referenced by issue #80396, Potential candidates for corrective releases
1 changed files with 3 additions and 3 deletions

View File

@ -322,6 +322,8 @@ void createTransUVs(bContext *C, TransInfo *t)
}
}
float *prop_dists = NULL;
/* Support other objects using PET to adjust these, unless connected is enabled. */
if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) {
goto finally;
@ -349,8 +351,6 @@ void createTransUVs(bContext *C, TransInfo *t)
td = tc->data;
td2d = tc->data_2d;
float *prop_dists = NULL;
if (is_prop_connected) {
prop_dists = MEM_callocN(em->bm->totloop * sizeof(float), "TransObPropDists(UV Editing)");
@ -397,7 +397,7 @@ void createTransUVs(bContext *C, TransInfo *t)
finally:
if (is_prop_connected) {
MEM_freeN(prop_dists);
MEM_SAFE_FREE(prop_dists);
}
if (is_island_center) {
BM_uv_element_map_free(elementmap);