aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-12-28 01:37:15 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-12-28 01:37:15 +0300
commit6ec50b9c3ff94b9d2f1c0a3216157fae9b6ea984 (patch)
tree601ba903b84b90f0ad2807c56b3f21b113343cae
parent4264aa5d468652e80443bcc1f38b3e3c478bc51a (diff)
Fix segmentation fault due to double-free attempt in pkgconf_pkg_cflags()
-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)
{