From d0c10a795e2a58f9039c3558872df287daf55433 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 4 May 2025 20:26:06 +1000 Subject: [PATCH] Free memory on failure to create temporary directory Signed-off-by: Allan McRae --- lib/libalpm/util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index ffc18d14..7877b17a 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -967,8 +967,7 @@ char *_alpm_temporary_download_dir_setup(const char *dir, const char *user) char *newdir = NULL; MALLOC(newdir, newdirlen, return NULL); snprintf(newdir, newdirlen - 1, "%s%s", dir, template); - newdir = mkdtemp(newdir); - if(newdir == NULL) { + if(mkdtemp(newdir) == NULL) { free(newdir); return NULL; }