From 2e559ba431aa2cf78e3296a85ff090bd7b6b0fe6 Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Mon, 7 Nov 2005 12:59:29 +0000 Subject: added a FREESYNC macro to release pointers to pmsyncpkg_t structures --- lib/libalpm/sync.h | 2 ++ lib/libalpm/trans.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libalpm/sync.h b/lib/libalpm/sync.h index 615e17d2..59c42064 100644 --- a/lib/libalpm/sync.h +++ b/lib/libalpm/sync.h @@ -31,6 +31,8 @@ typedef struct __pmsyncpkg_t { void *data; } pmsyncpkg_t; +#define FREESYNC(p) do { if(p) { sync_free(p); p = NULL; } } while(0) + pmsyncpkg_t *sync_new(int type, pmpkg_t *spkg, void *data); void sync_free(pmsyncpkg_t *sync); diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 7a91cb9b..e4ab72bf 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -66,8 +66,7 @@ void trans_free(pmtrans_t *trans) if(trans->type == PM_TRANS_TYPE_SYNC) { PMList *i; for(i = trans->packages; i; i = i->next) { - sync_free(i->data); - i->data = NULL; + FREESYNC(i->data); } FREELIST(trans->packages); FREELIST(trans->skiplist); -- cgit v1.2.3-70-g09d2