xbps_symlink_target: double free in rootdir == '/' case.
This commit is contained in:
parent
6d65e76f91
commit
9083191e4b
@ -503,12 +503,13 @@ xbps_symlink_target(struct xbps_handle *xhp, const char *path, const char *tgt)
|
|||||||
if (res == NULL) {
|
if (res == NULL) {
|
||||||
if (strcmp(xhp->rootdir, "/") == 0)
|
if (strcmp(xhp->rootdir, "/") == 0)
|
||||||
res = p;
|
res = p;
|
||||||
else
|
else {
|
||||||
res = strdup(p + strlen(xhp->rootdir));
|
res = strdup(p + strlen(xhp->rootdir));
|
||||||
|
free(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
assert(res);
|
assert(res);
|
||||||
free(lnk);
|
free(lnk);
|
||||||
free(p);
|
|
||||||
} else {
|
} else {
|
||||||
/* absolute */
|
/* absolute */
|
||||||
res = lnk;
|
res = lnk;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user