UI: fix memory leak when copy-to-selected failed
This commit is contained in:
parent
3aaf908719
commit
9da098536d
|
@ -494,10 +494,11 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
|
|||
char *path = NULL;
|
||||
bool use_path_from_id;
|
||||
CollectionPointerLink *link;
|
||||
ListBase lb;
|
||||
ListBase lb = {NULL};
|
||||
|
||||
if (!UI_context_copy_to_selected_list(C, &ptr, prop, &lb, &use_path_from_id, &path))
|
||||
return success;
|
||||
if (!UI_context_copy_to_selected_list(C, &ptr, prop, &lb, &use_path_from_id, &path)) {
|
||||
goto finally;
|
||||
}
|
||||
|
||||
for (link = lb.first; link; link = link->next) {
|
||||
if (link->ptr.data != ptr.data) {
|
||||
|
@ -539,6 +540,7 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
|
|||
}
|
||||
}
|
||||
|
||||
finally:
|
||||
MEM_SAFE_FREE(path);
|
||||
BLI_freelistN(&lb);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue