main: cleanup after checking module versions

Dylan Baker 2022-07-27 14:21:15 -07:00
parent ee06ab42d2
commit 09c224dd7d
1 changed files with 12 additions and 6 deletions

View File

@ -1183,17 +1183,19 @@ main(int argc, char *argv[])
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package); pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto cleanup;
} }
if (pkgconf_compare_version(pkg->version, required_module_version) >= 0) if (pkgconf_compare_version(pkg->version, required_module_version) >= 0)
{ {
ret = EXIT_SUCCESS; ret = EXIT_SUCCESS;
goto out; goto cleanup;
} }
} }
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
cleanup:
pkgconf_dependency_free(&deplist);
goto out; goto out;
} }
else if (required_exact_module_version != NULL) 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); pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto cleanup2;
} }
if (pkgconf_compare_version(pkg->version, required_exact_module_version) == 0) if (pkgconf_compare_version(pkg->version, required_exact_module_version) == 0)
{ {
ret = EXIT_SUCCESS; ret = EXIT_SUCCESS;
goto out; goto cleanup2;
} }
} }
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
cleanup2:
pkgconf_dependency_free(&deplist);
goto out; goto out;
} }
else if (required_max_module_version != NULL) 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); pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto out; goto cleanup3;
} }
if (pkgconf_compare_version(pkg->version, required_max_module_version) <= 0) if (pkgconf_compare_version(pkg->version, required_max_module_version) <= 0)
{ {
ret = EXIT_SUCCESS; ret = EXIT_SUCCESS;
goto out; goto cleanup3;
} }
} }
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
cleanup3:
pkgconf_dependency_free(&deplist);
goto out; goto out;
} }