From: Marek Schimara Date: Thu, 16 Jun 2016 09:16:48 +0000 (+0200) Subject: src/rrd_info.c: fix Coverity CID#26535 Resource leak X-Git-Tag: v1.7.0~42^2~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b04c29cb6b37b9c557c3fe668d8bc6e4df2b863;p=thirdparty%2Frrdtool-1.x.git src/rrd_info.c: fix Coverity CID#26535 Resource leak CWE-404 / https://cwe.mitre.org/data/definitions/404.html --- diff --git a/src/rrd_info.c b/src/rrd_info.c index 015cc19a..da60ef32 100644 --- a/src/rrd_info.c +++ b/src/rrd_info.c @@ -120,6 +120,7 @@ rrd_info_t *rrd_info( case '?': rrd_set_error("%s", options.errmsg); + if (opt_daemon) free (opt_daemon); return NULL; } } /* while (opt != -1) */ @@ -127,12 +128,16 @@ rrd_info_t *rrd_info( if (options.argc - options.optind != 1) { rrd_set_error ("Usage: rrdtool %s [--daemon |-d [--noflush|-F]] ", options.argv[0]); + if (opt_daemon) free (opt_daemon); return NULL; } if (flushfirst) { status = rrdc_flush_if_daemon(opt_daemon, options.argv[options.optind]); - if (status) return (NULL); + if (status) { + if (opt_daemon) free (opt_daemon); + return (NULL); + } } rrdc_connect (opt_daemon);