[Bf-blender-cvs] [f4d46916fab] master: UI: fix memory leak when copy-to-selected failed
Campbell Barton
noreply at git.blender.org
Thu Sep 7 14:07:11 CEST 2017
Commit: f4d46916fab002cefea632dad685e6beb5b4a427
Author: Campbell Barton
Date: Thu Sep 7 22:13:28 2017 +1000
Branches: master
https://developer.blender.org/rBf4d46916fab002cefea632dad685e6beb5b4a427
UI: fix memory leak when copy-to-selected failed
===================================================================
M source/blender/editors/interface/interface_ops.c
===================================================================
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 580ad025086..ce3cf24f292 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -497,10 +497,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) {
@@ -542,6 +543,7 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
}
}
+finally:
MEM_SAFE_FREE(path);
BLI_freelistN(&lb);
}
More information about the Bf-blender-cvs
mailing list