main: unref another pkg

Dylan Baker 2022-08-02 11:59:55 -07:00
parent dbc8d248c7
commit 116e367525
1 changed files with 9 additions and 3 deletions

View File

@ -1162,7 +1162,7 @@ main(int argc, char *argv[])
if (required_module_version != NULL) if (required_module_version != NULL)
{ {
pkgconf_pkg_t *pkg; pkgconf_pkg_t *pkg = NULL;
pkgconf_node_t *node; pkgconf_node_t *node;
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER; pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
@ -1195,12 +1195,14 @@ main(int argc, char *argv[])
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
cleanup: cleanup:
if (pkg)
pkgconf_pkg_unref(&pkg_client, pkg);
pkgconf_dependency_free(&deplist); pkgconf_dependency_free(&deplist);
goto out; goto out;
} }
else if (required_exact_module_version != NULL) else if (required_exact_module_version != NULL)
{ {
pkgconf_pkg_t *pkg; pkgconf_pkg_t *pkg = NULL;
pkgconf_node_t *node; pkgconf_node_t *node;
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER; pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
@ -1233,12 +1235,14 @@ cleanup:
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
cleanup2: cleanup2:
if (pkg)
pkgconf_pkg_unref(&pkg_client, pkg);
pkgconf_dependency_free(&deplist); pkgconf_dependency_free(&deplist);
goto out; goto out;
} }
else if (required_max_module_version != NULL) else if (required_max_module_version != NULL)
{ {
pkgconf_pkg_t *pkg; pkgconf_pkg_t *pkg = NULL;
pkgconf_node_t *node; pkgconf_node_t *node;
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER; pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
@ -1271,6 +1275,8 @@ cleanup2:
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
cleanup3: cleanup3:
if (pkg)
pkgconf_pkg_unref(&pkg_client, pkg);
pkgconf_dependency_free(&deplist); pkgconf_dependency_free(&deplist);
goto out; goto out;
} }