From 09c224dd7dc9c9a9d52501fd49ee44fa50412a01 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 27 Jul 2022 14:21:15 -0700 Subject: [PATCH] main: cleanup after checking module versions --- cli/main.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cli/main.c b/cli/main.c index b37a37a..d2fccc3 100644 --- a/cli/main.c +++ b/cli/main.c @@ -1183,17 +1183,19 @@ main(int argc, char *argv[]) pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package); ret = EXIT_FAILURE; - goto out; + goto cleanup; } if (pkgconf_compare_version(pkg->version, required_module_version) >= 0) { ret = EXIT_SUCCESS; - goto out; + goto cleanup; } } ret = EXIT_FAILURE; +cleanup: + pkgconf_dependency_free(&deplist); goto out; } else if (required_exact_module_version != NULL) @@ -1219,17 +1221,19 @@ main(int argc, char *argv[]) pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package); ret = EXIT_FAILURE; - goto out; + goto cleanup2; } if (pkgconf_compare_version(pkg->version, required_exact_module_version) == 0) { ret = EXIT_SUCCESS; - goto out; + goto cleanup2; } } ret = EXIT_FAILURE; +cleanup2: + pkgconf_dependency_free(&deplist); goto out; } else if (required_max_module_version != NULL) @@ -1255,17 +1259,19 @@ main(int argc, char *argv[]) pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package); ret = EXIT_FAILURE; - goto out; + goto cleanup3; } if (pkgconf_compare_version(pkg->version, required_max_module_version) <= 0) { ret = EXIT_SUCCESS; - goto out; + goto cleanup3; } } ret = EXIT_FAILURE; +cleanup3: + pkgconf_dependency_free(&deplist); goto out; }