From 4f8d329867b17dd4fac3743b1741dce4612dad79 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 5 Apr 2009 12:47:02 +0200 Subject: [PATCH] xbps_remove_binary_pkg_meta(): fix a memleak if opendir(2) fails. --HG-- extra : convert_revision : e5a107219e809abf4a8f5fac8e066016b1d46455 --- lib/remove.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/remove.c b/lib/remove.c index a1bbd02c20e..f54bb4e1e5a 100644 --- a/lib/remove.c +++ b/lib/remove.c @@ -81,8 +81,10 @@ xbps_remove_binary_pkg_meta(const char *pkgname) return errno; dirp = opendir(metadir); - if (dirp == NULL) + if (dirp == NULL) { + free(metadir); return errno; + } while ((dp = readdir(dirp)) != NULL) { if ((strcmp(dp->d_name, ".") == 0) ||