summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2020-04-21 21:02:32 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2020-04-21 21:02:32 +0200
commitd0fb4ff187c8bb6a92724d28e76438c887344cfc (patch)
treeaa7c8489b40d6f9a8adb87e6cd917ecbc5501767 /src
parent3addad2cfa45de0252b63adfa8c3f868076c3f40 (diff)
downloadcc4group-d0fb4ff187c8bb6a92724d28e76438c887344cfc.tar.gz
cc4group-d0fb4ff187c8bb6a92724d28e76438c887344cfc.zip
Fix memory leak in cc4group.getFullName
Diffstat (limited to 'src')
-rw-r--r--src/cc4group.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cc4group.c b/src/cc4group.c
index da1ead4..7f822d9 100644
--- a/src/cc4group.c
+++ b/src/cc4group.c
@@ -3344,17 +3344,17 @@ static char* cc4group_getFullName(const CC4Group* const this)
child = child->parent;
}
+ char* result = NULL;
if(!child->path)
{
- GroupListDestroy(groups);
- return NULL;
+ goto ret;
}
len += strlen(child->path) + 1;
- char* result = malloc(sizeof(char) * len);
+ result = malloc(sizeof(char) * len);
if(result == NULL)
{
- return NULL;
+ goto ret;
}
strcpy(result, child->path);
@@ -3364,6 +3364,8 @@ static char* cc4group_getFullName(const CC4Group* const this)
strcat(result, group->value->pathInParent);
}
+ret:
+ GroupListDestroy(groups);
return result;
}