cleanup: fix memory leak

get_local_dir() returns the copy of a c-string. It therefore
has to be free()d.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-02-28 06:23:26 +01:00 committed by Dirk Hohndel
parent a4091189b0
commit 805cd550f2

View file

@ -161,7 +161,9 @@ char *get_local_dir(const char *url, const char *branch)
static char *move_local_cache(struct git_info *info)
{
char *old_path = get_local_dir(info->url, info->branch);
return move_away(old_path);
char *new_path = move_away(old_path);
free(old_path);
return new_path;
}
static int check_clean(const char *path, unsigned int status, void *payload)