Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/list.c')
-rw-r--r--lib/libalpm/list.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libalpm/list.c b/lib/libalpm/list.c
index be41a462..0f48030b 100644
--- a/lib/libalpm/list.c
+++ b/lib/libalpm/list.c
@@ -26,6 +26,7 @@
#include <assert.h>
/* pacman */
#include "list.h"
+#include "util.h"
pmlist_t *_alpm_list_new()
{
@@ -48,10 +49,10 @@ void _alpm_list_free(pmlist_t *list, _alpm_fn_free fn)
while(it) {
ptr = it->next;
- if(fn) {
+ if(fn && it->data) {
fn(it->data);
}
- free(it);
+ FREE(it);
it = ptr;
}
}
@@ -180,7 +181,7 @@ pmlist_t *_alpm_list_remove(pmlist_t *haystack, void *needle, _alpm_fn_cmp fn, v
*data = i->data;
}
i->data = NULL;
- free(i);
+ FREE(i);
}
return(haystack);