From 6ec50b9c3ff94b9d2f1c0a3216157fae9b6ea984 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 28 Dec 2018 01:37:15 +0300 Subject: Fix segmentation fault due to double-free attempt in pkgconf_pkg_cflags() --- libpkgconf/pkg.c | 7 +++++++ 1 file changed, 7 insertions(+) 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) { -- cgit v1.1