X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_flushcached.c;h=5d18a1e211549e948f863c978771dbf2c1787bf8;hb=6f5e93c0c08c5ed796d8d079f0eba2d16c6a4bdb;hp=fb9345b4ea8ee1382257c9ce567a2fe71840b121;hpb=cd6581d4edf9cd9c73f023eb9b1f5529959bf816;p=rrdtool.git diff --git a/src/rrd_flushcached.c b/src/rrd_flushcached.c index fb9345b..5d18a1e 100644 --- a/src/rrd_flushcached.c +++ b/src/rrd_flushcached.c @@ -74,7 +74,6 @@ 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 (! rrdc_is_connected(opt_daemon)) @@ -87,7 +86,7 @@ int rrd_flushcached (int argc, char **argv) } status = 0; - for (int i = optind; i < argc; i++) + for (i = optind; i < argc; i++) { status = rrdc_flush(argv[i]); if (status) @@ -107,6 +106,8 @@ int rrd_flushcached (int argc, char **argv) } } + if (opt_daemon) free(opt_daemon); + return ((status == 0) ? 0 : -1); } /* int rrd_flush */