From: oetiker Date: Tue, 25 May 2004 20:53:21 +0000 (+0000) Subject: prevent small leak when resources are exhausted -- Mike Slifcak X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e683033e7b9a149687a69a2ab5766f679fd9d194;p=rrdtool-all.git prevent small leak when resources are exhausted -- Mike Slifcak git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@264 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_create.c b/program/src/rrd_create.c index 6573fc5a..90c38d33 100644 --- a/program/src/rrd_create.c +++ b/program/src/rrd_create.c @@ -103,12 +103,14 @@ rrd_create_r(char *filename, /* static header */ if((rrd.stat_head = calloc(1,sizeof(stat_head_t)))==NULL){ rrd_set_error("allocating rrd.stat_head"); + rrd_free(&rrd); return(-1); } /* live header */ if((rrd.live_head = calloc(1,sizeof(live_head_t)))==NULL){ rrd_set_error("allocating rrd.live_head"); + rrd_free(&rrd); return(-1); } @@ -388,6 +390,7 @@ rrd_create_r(char *filename, fprintf(stderr,"Creating HW contingent RRAs\n"); #endif if (create_hw_contingent_rras(&rrd,period,hashed_name) == -1) { + rrd_set_error("creating contingent RRA"); rrd_free(&rrd); return -1; } diff --git a/program/src/rrd_dump.c b/program/src/rrd_dump.c index e92bd8d4..a8887ee8 100644 --- a/program/src/rrd_dump.c +++ b/program/src/rrd_dump.c @@ -5,6 +5,9 @@ ***************************************************************************** * $Id$ * $Log$ + * Revision 1.7 2004/05/25 20:53:21 oetiker + * prevent small leak when resources are exhausted -- Mike Slifcak + * * Revision 1.6 2004/05/25 20:51:49 oetiker * Update displayed copyright messages to be consistent. -- Mike Slifcak * @@ -72,6 +75,7 @@ rrd_dump_r(char *filename) rrd_value_t value; struct tm tm; if(rrd_open(filename, &in_file,&rrd, RRD_READONLY)==-1){ + rrd_free(&rrd); return(-1); }