xbps_symlink_target: fix two memleaks found by clang-analyzer.
This commit is contained in:
parent
042ab422b2
commit
87f7766c5f
@ -545,6 +545,7 @@ xbps_symlink_target(struct xbps_handle *xhp, const char *path, const char *tgt)
|
|||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
/* dangling symlink, use target */
|
/* dangling symlink, use target */
|
||||||
free(rootdir);
|
free(rootdir);
|
||||||
|
free(lnk);
|
||||||
return strdup(tgt);
|
return strdup(tgt);
|
||||||
}
|
}
|
||||||
if (strcmp(rootdir, "/") == 0) {
|
if (strcmp(rootdir, "/") == 0) {
|
||||||
@ -568,6 +569,7 @@ xbps_symlink_target(struct xbps_handle *xhp, const char *path, const char *tgt)
|
|||||||
assert(p1);
|
assert(p1);
|
||||||
res = xbps_sanitize_path(p1);
|
res = xbps_sanitize_path(p1);
|
||||||
free(p1);
|
free(p1);
|
||||||
|
free(p);
|
||||||
} else {
|
} else {
|
||||||
p1 = strdup(dname + strlen(rootdir));
|
p1 = strdup(dname + strlen(rootdir));
|
||||||
assert(p1);
|
assert(p1);
|
||||||
|
Loading…
Reference in New Issue
Block a user