From: Tobias Oetiker Date: Sun, 4 Oct 2009 21:16:34 +0000 (+0000) Subject: Fix potential memory leak in rrd_flushcached during failure. -- kevin X-Git-Tag: 1.4.0~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92a45fbffdd2c6df385efe2e66da24467535022a;p=thirdparty%2Frrdtool-1.x.git Fix potential memory leak in rrd_flushcached during failure. -- kevin git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1934 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_flushcached.c b/src/rrd_flushcached.c index 5d18a1e2..93b0fb57 100644 --- a/src/rrd_flushcached.c +++ b/src/rrd_flushcached.c @@ -74,7 +74,7 @@ int rrd_flushcached (int argc, char **argv) /* try to connect to rrdcached */ status = rrdc_connect(opt_daemon); - if (status != 0) return status; + if (status != 0) goto out; if (! rrdc_is_connected(opt_daemon)) { @@ -82,7 +82,8 @@ int rrd_flushcached (int argc, char **argv) "option to set an address on the command line or set the " "\"%s\" environment variable.", ENV_RRDCACHED_ADDRESS); - return (-1); + status = -1; + goto out; } status = 0; @@ -106,9 +107,10 @@ int rrd_flushcached (int argc, char **argv) } } +out: if (opt_daemon) free(opt_daemon); - return ((status == 0) ? 0 : -1); + return status; } /* int rrd_flush */ /*