[Bf-blender-cvs] [9da098536d1] blender-v2.79-release: UI: fix memory leak when copy-to-selected failed

Campbell Barton noreply at git.blender.org
Fri Sep 8 12:08:21 CEST 2017


Commit: 9da098536d140690a24a4c705c9bf061bd397d92
Author: Campbell Barton
Date:   Thu Sep 7 22:13:28 2017 +1000
Branches: blender-v2.79-release
https://developer.blender.org/rB9da098536d140690a24a4c705c9bf061bd397d92

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 fb95cdf389b..e0a9efb7571 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -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);
 	}



More information about the Bf-blender-cvs mailing list