aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpkgconf/pkg.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c
index 24ace6f..74a01a9 100644
--- a/libpkgconf/pkg.c
+++ b/libpkgconf/pkg.c
@@ -1578,8 +1578,15 @@ pkgconf_pkg_cflags(pkgconf_client_t *client, pkgconf_pkg_t *root, pkgconf_list_t
unsigned int skip_flags = (client->flags & PKGCONF_PKG_PKGF_DONT_FILTER_INTERNAL_CFLAGS) == 0 ? PKGCONF_PKG_DEPF_INTERNAL : 0;
eflag = pkgconf_pkg_traverse(client, root, pkgconf_pkg_cflags_collect, list, maxdepth, skip_flags);
+
+/*
+ * Fix the double-free attempt (issue #20 is reported).
+ */
if (eflag != PKGCONF_PKG_ERRF_OK)
+ {
pkgconf_fragment_free(list);
+ return eflag;
+ }
if (client->flags & PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS)
{