From 7e0b0fadabce8a212d842ded0f0127abd22470bb Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Thu, 11 Jul 2019 03:38:58 -0500 Subject: [PATCH] libpkgconf: path: fix memory leak when deduping paths (closes #39) --- libpkgconf/path.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpkgconf/path.c b/libpkgconf/path.c index bfb3a2c..3cc89f5 100644 --- a/libpkgconf/path.c +++ b/libpkgconf/path.c @@ -95,7 +95,12 @@ pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter) char *linkdest = realpath(path, NULL); if (linkdest != NULL && stat(linkdest, &st) == -1) + { + free(linkdest); return; + } + + free(linkdest); } if (path_list_contains_entry(path, dirlist, &st)) return;