summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/alpm_list.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c
index 59f99f9b..a3c73aa0 100644
--- a/lib/libalpm/alpm_list.c
+++ b/lib/libalpm/alpm_list.c
@@ -70,11 +70,13 @@ void SYMEXPORT alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn)
{
alpm_list_t *it = list;
- while(it) {
- if(fn && it->data) {
- fn(it->data);
+ if(fn) {
+ while(it) {
+ if(it->data) {
+ fn(it->data);
+ }
+ it = it->next;
}
- it = it->next;
}
}