fixed some memory leaks

This commit is contained in:
Marc
2022-10-05 19:08:57 +02:00
parent 3376ac1da6
commit 7725e19069
9 changed files with 88 additions and 25 deletions
+1
View File
@@ -36,6 +36,7 @@ static TypeDescriptor_t getDescriptor(const char * descriptor) {
}
void freeGroup(FOModGroup_t * group) {
free(group->name);
if(group->pluginCount == 0) return;
for(int pluginId = 0; pluginId < group->pluginCount; pluginId++) {
FOModPlugin_t * plugin = &group->plugins[pluginId];
+2 -1
View File
@@ -36,16 +36,17 @@ void freeFOMod(FOMod_t * fomod) {
for(int groupId = 0; groupId < step->groupCount; groupId++) {
FOModGroup_t * group = &step->groups[groupId];
freeGroup(group);
free(step->groups[groupId].plugins);
}
for(int flagId = 0; flagId < step->flagCount; flagId++) {
FOModFlag_t * flag = &(step->requiredFlags[flagId]);
free(flag->name);
free(flag->value);
}
free(step->groups);
free(step->requiredFlags);
free(step->name);
}
free(fomod->steps);
//set every counter to zero and every pointer to null
memset(fomod, 0, sizeof(FOMod_t));