Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-01-22 18:57:02 +0300
committerJulian Eisel <julian@blender.org>2021-01-22 18:58:23 +0300
commit3469e06c1a6b84fbf6888f57e8f03653bacce354 (patch)
tree41a0fc69274774455e58150efdf8726641e6c745
parentbbe6d44928235cd4a5cfbeaf1a1de78ed861bb92 (diff)
Fix memory leak when opening file browser
The name string of each file was duplicated but not freed. The new flag to ensure the file-list frees the name wasn't set. Mistake in ca475479eb26.
-rw-r--r--source/blender/editors/space_file/filelist.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index a50751b6b96..33c37875372 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1954,7 +1954,13 @@ static FileDirEntry *filelist_file_create_entry(FileList *filelist, const int in
ret->entry = rev;
ret->relpath = BLI_strdup(entry->relpath);
- ret->name = entry->free_name ? BLI_strdup(entry->name) : entry->name;
+ if (entry->free_name) {
+ ret->name = BLI_strdup(entry->name);
+ ret->flags |= FILE_ENTRY_NAME_FREE;
+ }
+ else {
+ ret->name = entry->name;
+ }
ret->description = BLI_strdupcat(filelist->filelist.root, entry->relpath);
memcpy(ret->uuid, entry->uuid, sizeof(ret->uuid));
ret->blentype = entry->blentype;