xbps-create: fix memleak introduced in 0f3ed2067c
This commit is contained in:
@@ -392,6 +392,7 @@ ftw_cb(const char *fpath, const struct stat *sb, const struct dirent *dir UNUSED
|
|||||||
assert(xe->target);
|
assert(xe->target);
|
||||||
xbps_dictionary_set_cstring(fileinfo, "target", xe->target);
|
xbps_dictionary_set_cstring(fileinfo, "target", xe->target);
|
||||||
} else {
|
} else {
|
||||||
|
char *p3;
|
||||||
/*
|
/*
|
||||||
* Sanitize destdir just in case.
|
* 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));
|
die("failed to sanitize destdir %s: %s", destdir, strerror(errno));
|
||||||
|
|
||||||
|
|
||||||
p2 = strdup(p+strlen(p2));
|
p3 = strdup(p+strlen(p2));
|
||||||
assert(p2);
|
assert(p2);
|
||||||
xe->target = xbps_sanitize_path(p2);
|
xe->target = xbps_sanitize_path(p3);
|
||||||
assert(xe->target);
|
assert(xe->target);
|
||||||
|
free(p3);
|
||||||
xbps_dictionary_set_cstring(fileinfo, "target", xe->target);
|
xbps_dictionary_set_cstring(fileinfo, "target", xe->target);
|
||||||
free(p);
|
free(p);
|
||||||
free(p2);
|
free(p2);
|
||||||
|
Reference in New Issue
Block a user