From b7d584feb68ebea877e65e248deca7af8aa4189a Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Wed, 20 Apr 2005 19:41:54 +0000 Subject: - fixed args order in list_is_ptrin() - fixed several memory leaks --- lib/libalpm/deps.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'lib/libalpm/deps.c') diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 504ffd3e..5adb9d60 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -212,8 +212,10 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) STRNCPY(miss->target, p->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, depend.name, PKG_NAME_LEN); STRNCPY(miss->depend.version, depend.version, PKG_VERSION_LEN); - if(!pm_list_is_ptrin(baddeps, miss)) { + if(!pm_list_is_ptrin(miss, baddeps)) { baddeps = pm_list_add(baddeps, miss); + } else { + FREE(miss); } } FREEPKG(p); @@ -240,8 +242,10 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) miss->depend.version[0] = '\0'; STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, dp->name, PKG_NAME_LEN); - if(!pm_list_is_ptrin(baddeps, miss)) { + if(!pm_list_is_ptrin(miss, baddeps)) { baddeps = pm_list_add(baddeps, miss); + } else { + FREE(miss); } } } @@ -255,8 +259,10 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) miss->depend.version[0] = '\0'; STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, a->name, PKG_NAME_LEN); - if(!pm_list_is_ptrin(baddeps, miss)) { + if(!pm_list_is_ptrin(miss, baddeps)) { baddeps = pm_list_add(baddeps, miss); + } else { + FREE(miss); } } } @@ -272,8 +278,10 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) miss->depend.version[0] = '\0'; STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, info->name, PKG_NAME_LEN); - if(!pm_list_is_ptrin(baddeps, miss)) { + if(!pm_list_is_ptrin(miss, baddeps)) { baddeps = pm_list_add(baddeps, miss); + } else { + FREE(miss); } } } @@ -411,8 +419,10 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, depend.name, PKG_NAME_LEN); STRNCPY(miss->depend.version, depend.version, PKG_VERSION_LEN); - if(!pm_list_is_ptrin(baddeps, miss)) { + if(!pm_list_is_ptrin(miss, baddeps)) { baddeps = pm_list_add(baddeps, miss); + } else { + FREE(miss); } } } @@ -433,8 +443,10 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) miss->depend.version[0] = '\0'; STRNCPY(miss->target, tp->name, PKG_NAME_LEN); STRNCPY(miss->depend.name, (char *)j->data, PKG_NAME_LEN); - if(!pm_list_is_ptrin(baddeps, miss)) { + if(!pm_list_is_ptrin(miss, baddeps)) { baddeps = pm_list_add(baddeps, miss); + } else { + FREE(miss); } } } -- cgit v1.2.3-70-g09d2