From 6210955010c6604b4e4299f094ec5136e25d53ce Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 27 Dec 2019 23:09:24 +0100 Subject: [PATCH] xbps-create: fix memleak introduced in 0f3ed2067c --- bin/xbps-create/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c index b8669bd2..e9cfcb62 100644 --- a/bin/xbps-create/main.c +++ b/bin/xbps-create/main.c @@ -392,6 +392,7 @@ ftw_cb(const char *fpath, const struct stat *sb, const struct dirent *dir UNUSED assert(xe->target); xbps_dictionary_set_cstring(fileinfo, "target", xe->target); } else { + char *p3; /* * Sanitize destdir just in case. */ @@ -399,10 +400,11 @@ ftw_cb(const char *fpath, const struct stat *sb, const struct dirent *dir UNUSED die("failed to sanitize destdir %s: %s", destdir, strerror(errno)); - p2 = strdup(p+strlen(p2)); + p3 = strdup(p+strlen(p2)); assert(p2); - xe->target = xbps_sanitize_path(p2); + xe->target = xbps_sanitize_path(p3); assert(xe->target); + free(p3); xbps_dictionary_set_cstring(fileinfo, "target", xe->target); free(p); free(p2);