xbps_end: don't continue if we don't have a valid xbps_handle pointer.

This commit is contained in:
Juan RP 2011-12-22 16:55:35 +01:00
parent 3d81d497bd
commit ca0905925f
4 changed files with 11 additions and 14 deletions

View File

@ -71,15 +71,15 @@ int HIDDEN dewey_match(const char *, const char *);
* @private * @private
* From lib/regpkgdb_dictionary.c * From lib/regpkgdb_dictionary.c
*/ */
int HIDDEN xbps_regpkgdb_dictionary_init(struct xbps_handle *xhp); int HIDDEN xbps_regpkgdb_dictionary_init(struct xbps_handle *);
void HIDDEN xbps_regpkgdb_dictionary_release(void); void HIDDEN xbps_regpkgdb_dictionary_release(struct xbps_handle *);
/** /**
* @private * @private
* From lib/repository_pool.c * From lib/repository_pool.c
*/ */
int HIDDEN xbps_repository_pool_init(struct xbps_handle *); 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 * @private

View File

@ -184,12 +184,13 @@ xbps_init(struct xbps_handle *xh)
void void
xbps_end(struct xbps_handle *xh) xbps_end(struct xbps_handle *xh)
{ {
xbps_regpkgdb_dictionary_release();
xbps_repository_pool_release();
xbps_fetch_unset_cache_connection();
if (xh == NULL) if (xh == NULL)
return; return;
xbps_regpkgdb_dictionary_release(xh);
xbps_repository_pool_release(xh);
xbps_fetch_unset_cache_connection();
if (xh->cfg != NULL) if (xh->cfg != NULL)
cfg_free(xh->cfg); cfg_free(xh->cfg);
if (xh->cachedir_priv != NULL) if (xh->cachedir_priv != NULL)

View File

@ -88,14 +88,11 @@ xbps_regpkgdb_dictionary_init(struct xbps_handle *xhp)
} }
void HIDDEN void HIDDEN
xbps_regpkgdb_dictionary_release(void) xbps_regpkgdb_dictionary_release(struct xbps_handle *xhp)
{ {
struct xbps_handle *xhp;
if (!regpkgdb_initialized) if (!regpkgdb_initialized)
return; return;
xhp = xbps_handle_get();
prop_object_release(xhp->regpkgdb_dictionary); prop_object_release(xhp->regpkgdb_dictionary);
regpkgdb_initialized = false; regpkgdb_initialized = false;
xbps_dbg_printf("[regpkgdb] released ok.\n"); xbps_dbg_printf("[regpkgdb] released ok.\n");

View File

@ -148,16 +148,15 @@ xbps_repository_pool_init(struct xbps_handle *xhp)
xbps_dbg_printf("[rpool] initialized ok.\n"); xbps_dbg_printf("[rpool] initialized ok.\n");
out: out:
if (rv != 0) if (rv != 0)
xbps_repository_pool_release(); xbps_repository_pool_release(xhp);
return rv; return rv;
} }
void HIDDEN 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; prop_dictionary_t d;
size_t i; size_t i;
const char *uri; const char *uri;