added a FREESYNC macro to release pointers to pmsyncpkg_t structures
This commit is contained in:
parent
b2df466ffd
commit
2e559ba431
2 changed files with 3 additions and 2 deletions
|
@ -31,6 +31,8 @@ typedef struct __pmsyncpkg_t {
|
||||||
void *data;
|
void *data;
|
||||||
} pmsyncpkg_t;
|
} 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);
|
pmsyncpkg_t *sync_new(int type, pmpkg_t *spkg, void *data);
|
||||||
void sync_free(pmsyncpkg_t *sync);
|
void sync_free(pmsyncpkg_t *sync);
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,7 @@ void trans_free(pmtrans_t *trans)
|
||||||
if(trans->type == PM_TRANS_TYPE_SYNC) {
|
if(trans->type == PM_TRANS_TYPE_SYNC) {
|
||||||
PMList *i;
|
PMList *i;
|
||||||
for(i = trans->packages; i; i = i->next) {
|
for(i = trans->packages; i; i = i->next) {
|
||||||
sync_free(i->data);
|
FREESYNC(i->data);
|
||||||
i->data = NULL;
|
|
||||||
}
|
}
|
||||||
FREELIST(trans->packages);
|
FREELIST(trans->packages);
|
||||||
FREELIST(trans->skiplist);
|
FREELIST(trans->skiplist);
|
||||||
|
|
Loading…
Add table
Reference in a new issue