diff options
author | Dalai Felinto <dalai@blender.org> | 2020-10-16 18:16:48 +0300 |
---|---|---|
committer | Dalai Felinto <dalai@blender.org> | 2020-10-16 18:18:23 +0300 |
commit | 89ffdad0f35421f1ee974ad45c3bf197dd171c18 (patch) | |
tree | 660075dbb5f4e737b569a15d47176c69ca952f12 /source/blender | |
parent | 5ebdbcafcb2703f14f33738f1e852e5a3e1ab33a (diff) |
Fix misuse of alloc inside a loop
Alloc will only free its memory when the function is returned.
Issue introduced in c866075dfbd9. Thanks Sergey for spotting this.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 91253bcb671..453c6aa797c 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -257,14 +257,15 @@ void do_versions_after_linking_290(Main *bmain, ReportList *UNUSED(reports)) const size_t node_name_length = strlen(node->name); const size_t node_name_escaped_max_length = (node_name_length * 2); - char *node_name_escaped = BLI_array_alloca(node_name_escaped, - node_name_escaped_max_length + 1); + char *node_name_escaped = MEM_mallocN(node_name_escaped_max_length + 1, + "escaped name"); BLI_strescape(node_name_escaped, node->name, node_name_escaped_max_length); char *rna_path_prefix = BLI_sprintfN("nodes[\"%s\"].inputs", node_name_escaped); BKE_animdata_fix_paths_rename_all_ex( bmain, id, rna_path_prefix, NULL, NULL, input_id, input_id + 1, false); MEM_freeN(rna_path_prefix); + MEM_freeN(node_name_escaped); } } } |