summaryrefslogtreecommitdiffstats
path: root/src/cc4group.c
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2019-04-20 02:12:53 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2019-04-20 02:43:53 +0200
commitf5c99653dd12edc078df3246eb40b9f06e17778e (patch)
tree35f78b6c8c8a3c5a52aa53091053825719ec6c60 /src/cc4group.c
parentb6b269ecdecd80c3d1fae823a4c94f4afc72c125 (diff)
downloadcc4group-f5c99653dd12edc078df3246eb40b9f06e17778e.tar.gz
cc4group-f5c99653dd12edc078df3246eb40b9f06e17778e.zip
Fix memory leak in cc4group_createFile (and also a possible but really unlikely to happen memory leak in an error case in cc4group_createDirectory)
Diffstat (limited to 'src/cc4group.c')
-rw-r--r--src/cc4group.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cc4group.c b/src/cc4group.c
index 724a8b5..2b5a6b4 100644
--- a/src/cc4group.c
+++ b/src/cc4group.c
@@ -2144,7 +2144,6 @@ static C4GroupEntryData* cc4group_createEntry(CC4Group* const this, const char*
entry.data = NULL;
entry.memoryManagement = cc4group.MemoryManagement.Reference;
- entry.children = GroupEntryListNew();
C4GroupEntryCore_init(&entry.core);
C4GroupEntryCore_setFileName(&entry.core, targetName);
@@ -2166,6 +2165,7 @@ static bool cc4group_createDirectory(CC4Group* const this, const char* const pat
return false;
}
+
C4GroupHeader* header = malloc(sizeof(C4GroupHeader));
if(header == NULL)
@@ -2174,6 +2174,8 @@ static bool cc4group_createDirectory(CC4Group* const this, const char* const pat
return NULL;
}
+ entry->children = GroupEntryListNew();
+
C4GroupHeader_init(header);
C4GroupHeader_setOfficial(header, C4GroupHeader_isOfficial(entry->parent->header));
C4GroupHeader_setMaker(header, entry->parent->header->Maker);