xbps_symlink_target: fix two memleaks found by clang-analyzer.

This commit is contained in:
Juan RP 2019-06-18 14:39:27 +02:00
parent 042ab422b2
commit 87f7766c5f

View File

@ -545,6 +545,7 @@ xbps_symlink_target(struct xbps_handle *xhp, const char *path, const char *tgt)
if (p == NULL) {
/* dangling symlink, use target */
free(rootdir);
free(lnk);
return strdup(tgt);
}
if (strcmp(rootdir, "/") == 0) {
@ -568,6 +569,7 @@ xbps_symlink_target(struct xbps_handle *xhp, const char *path, const char *tgt)
assert(p1);
res = xbps_sanitize_path(p1);
free(p1);
free(p);
} else {
p1 = strdup(dname + strlen(rootdir));
assert(p1);