xbps_symlink_target: double free in rootdir == '/' case.

This commit is contained in:
Juan RP 2015-02-19 11:39:59 +01:00
parent 6d65e76f91
commit 9083191e4b

View File

@ -503,12 +503,13 @@ xbps_symlink_target(struct xbps_handle *xhp, const char *path, const char *tgt)
if (res == NULL) {
if (strcmp(xhp->rootdir, "/") == 0)
res = p;
else
else {
res = strdup(p + strlen(xhp->rootdir));
free(p);
}
}
assert(res);
free(lnk);
free(p);
} else {
/* absolute */
res = lnk;