xbps_symlink_target: fix a meamleak reported by clang-analyzer.
This commit is contained in:
parent
a00c7b1c4b
commit
bb977c73e4
@ -502,14 +502,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 = strdup(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…
Reference in New Issue
Block a user