From e275594ba697901921da86ded8819a4f4fb10c82 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 3 Aug 2022 15:56:54 -0700 Subject: [PATCH] queue: ensure cleanup happens when applying --- libpkgconf/queue.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libpkgconf/queue.c b/libpkgconf/queue.c index 61584d4..1c30f40 100644 --- a/libpkgconf/queue.c +++ b/libpkgconf/queue.c @@ -261,6 +261,7 @@ pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_lis bool pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data) { + bool ret = false; pkgconf_pkg_t world = { .id = "virtual:world", .realname = "virtual world package", @@ -272,18 +273,17 @@ pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queu maxdepth = -1; if (pkgconf_queue_verify(client, &world, list, maxdepth) != PKGCONF_PKG_ERRF_OK) - return false; + goto cleanup; /* the world dependency set is flattened after it is returned from pkgconf_queue_verify */ if (!func(client, &world, data, maxdepth)) - { - pkgconf_pkg_free(client, &world); - return false; - } + goto cleanup; + ret = true; + +cleanup: pkgconf_pkg_free(client, &world); - - return true; + return ret; } /*