From: Wolfgang Stöggl Date: Sat, 6 Jul 2019 12:14:28 +0000 (+0200) Subject: Fix possible memory leak by buffer.file X-Git-Tag: v1.8.0~81 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=23854c4c10fae3a549ce115b374d88f98c15255d;p=thirdparty%2Frrdtool-1.x.git Fix possible memory leak by buffer.file Close the opened buffer.file in rrd_xport.c before return -1, if the data processing has failed - Fixes the following Cppcheck error: [rrdtool-1.x/src/rrd_xport.c:435] (error) Memory leak: buffer.file [memleak] --- diff --git a/src/rrd_xport.c b/src/rrd_xport.c index 637df8ee..e69a8070 100644 --- a/src/rrd_xport.c +++ b/src/rrd_xport.c @@ -432,6 +432,10 @@ int rrd_graph_xport( /* do the data processing */ if (rrd_xport_fn(im, &start, &end, &step, &col_cnt, &legend_v, &data, 1)) { + /* close the file */ + if (buffer.file) { + fclose(buffer.file); + } return -1; }