xbps_symlink_target: fix a meamleak reported by clang-analyzer.

This commit is contained in:
Juan RP 2015-12-21 16:55:53 +01:00
parent a00c7b1c4b
commit bb977c73e4

View File

@ -502,14 +502,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 {
res = strdup(p);
else
res = strdup(p + strlen(xhp->rootdir));
free(p);
}
}
assert(res);
free(lnk);
free(p);
} else {
/* absolute */
res = lnk;