do not free list in the fct
[ppastats.git] / src / lp.c
index e738a6c..11866d7 100644 (file)
--- a/src/lp.c
+++ b/src/lp.c
@@ -175,7 +175,7 @@ void daily_download_total_list_free(struct daily_download_total **list)
 
 struct bpph **bpph_list_add(struct bpph **list, struct bpph *new)
 {
-       struct bpph **cur, *bpph;
+       struct bpph **cur, *bpph, **result;
 
        if (list)
                for (cur = list; *cur; cur++) {
@@ -185,7 +185,11 @@ struct bpph **bpph_list_add(struct bpph **list, struct bpph *new)
                                return list;
                }
 
-       return (struct bpph **)list_add((void **)list, new);
+       result = (struct bpph **)list_add((void **)list, new);
+
+       free(list);
+
+       return result;
 }
 
 struct bpph **bpph_list_append_list(struct bpph **list1, struct bpph **list2)