X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_flushcached.c;h=93b0fb57b05f32d356d2afd6145974fd88b8dbdd;hp=f7a715e110c85528ae991decff7ea10a8eecd5a7;hb=96b0f4aace0deef034a792a08dc2d426cd2b61a4;hpb=9e56458803c05e1b98591818412a08ffcf3f0401 diff --git a/src/rrd_flushcached.c b/src/rrd_flushcached.c index f7a715e..93b0fb5 100644 --- a/src/rrd_flushcached.c +++ b/src/rrd_flushcached.c @@ -74,8 +74,7 @@ int rrd_flushcached (int argc, char **argv) /* try to connect to rrdcached */ status = rrdc_connect(opt_daemon); - if (opt_daemon) free(opt_daemon); - if (status != 0) return status; + if (status != 0) goto out; if (! rrdc_is_connected(opt_daemon)) { @@ -83,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; @@ -107,7 +107,10 @@ int rrd_flushcached (int argc, char **argv) } } - return ((status == 0) ? 0 : -1); +out: + if (opt_daemon) free(opt_daemon); + + return status; } /* int rrd_flush */ /*