summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-20 19:41:54 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-04-20 19:41:54 +0000
commitb7d584feb68ebea877e65e248deca7af8aa4189a (patch)
treef3daf3b3257ed00b63f601d28af0860a9eacd1ee /lib
parent49d2cdc2f96e825eac943d0015030036295adfbf (diff)
- fixed args order in list_is_ptrin()
- fixed several memory leaks
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/deps.c24
1 files changed, 18 insertions, 6 deletions
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);
}
}
}