]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Avoid memory leak and handle out-of-memory in a forgotten case
authorPeter Stamfest <peter@stamfest.at>
Mon, 1 Sep 2014 18:37:44 +0000 (20:37 +0200)
committerPeter Stamfest <peter@stamfest.at>
Mon, 1 Sep 2014 19:03:00 +0000 (21:03 +0200)
src/rrd_create.c

index cee6c63364532296b5c4f3d3241ec7532277415d..cfd03e0dc74de6c2796a1b3fdb8fba62b26213e3 100644 (file)
@@ -2210,7 +2210,11 @@ static int rrd_prefill_data(rrd_t *rrd, const GList *sources, mapping_t *mapping
                     mappings, mappings_cnt,
                     cdp_match, NULL);
 
+            if (candidates == NULL && rrd_test_error()) {
+                goto done;
+            }
             prefill_cdp_prep(&target, candidates, candidate_cnt, cdp_rra_index);
+            free(candidates);
         }
         total_rows += rrd->rra_def[rra_index].row_cnt;
     }