diff --git a/include/xbps_api_impl.h b/include/xbps_api_impl.h index c15aa2fa..2891eb5c 100644 --- a/include/xbps_api_impl.h +++ b/include/xbps_api_impl.h @@ -71,15 +71,15 @@ int HIDDEN dewey_match(const char *, const char *); * @private * From lib/regpkgdb_dictionary.c */ -int HIDDEN xbps_regpkgdb_dictionary_init(struct xbps_handle *xhp); -void HIDDEN xbps_regpkgdb_dictionary_release(void); +int HIDDEN xbps_regpkgdb_dictionary_init(struct xbps_handle *); +void HIDDEN xbps_regpkgdb_dictionary_release(struct xbps_handle *); /** * @private * From lib/repository_pool.c */ int HIDDEN xbps_repository_pool_init(struct xbps_handle *); -void HIDDEN xbps_repository_pool_release(void); +void HIDDEN xbps_repository_pool_release(struct xbps_handle *); /** * @private diff --git a/lib/initend.c b/lib/initend.c index 160d2965..ba9c786e 100644 --- a/lib/initend.c +++ b/lib/initend.c @@ -184,12 +184,13 @@ xbps_init(struct xbps_handle *xh) void xbps_end(struct xbps_handle *xh) { - xbps_regpkgdb_dictionary_release(); - xbps_repository_pool_release(); - xbps_fetch_unset_cache_connection(); - if (xh == NULL) return; + + xbps_regpkgdb_dictionary_release(xh); + xbps_repository_pool_release(xh); + xbps_fetch_unset_cache_connection(); + if (xh->cfg != NULL) cfg_free(xh->cfg); if (xh->cachedir_priv != NULL) diff --git a/lib/regpkgdb_dictionary.c b/lib/regpkgdb_dictionary.c index d8f4a847..f4f1dc94 100644 --- a/lib/regpkgdb_dictionary.c +++ b/lib/regpkgdb_dictionary.c @@ -88,14 +88,11 @@ xbps_regpkgdb_dictionary_init(struct xbps_handle *xhp) } void HIDDEN -xbps_regpkgdb_dictionary_release(void) +xbps_regpkgdb_dictionary_release(struct xbps_handle *xhp) { - struct xbps_handle *xhp; - if (!regpkgdb_initialized) return; - xhp = xbps_handle_get(); prop_object_release(xhp->regpkgdb_dictionary); regpkgdb_initialized = false; xbps_dbg_printf("[regpkgdb] released ok.\n"); diff --git a/lib/repository_pool.c b/lib/repository_pool.c index 480d2c51..82982b46 100644 --- a/lib/repository_pool.c +++ b/lib/repository_pool.c @@ -148,16 +148,15 @@ xbps_repository_pool_init(struct xbps_handle *xhp) xbps_dbg_printf("[rpool] initialized ok.\n"); out: if (rv != 0) - xbps_repository_pool_release(); + xbps_repository_pool_release(xhp); return rv; } void HIDDEN -xbps_repository_pool_release(void) +xbps_repository_pool_release(struct xbps_handle *xhp) { - struct xbps_handle *xhp = xbps_handle_get(); prop_dictionary_t d; size_t i; const char *uri;