From 87f7766c5f3bc47e6c854da4f9081d37cc5666a6 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 18 Jun 2019 14:39:27 +0200 Subject: [PATCH] xbps_symlink_target: fix two memleaks found by clang-analyzer. --- lib/util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/util.c b/lib/util.c index 4777f8e2..9b1aa5f9 100644 --- a/lib/util.c +++ b/lib/util.c @@ -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);