*****************************************************************************
* $Id$
* $Log$
- * Revision 1.1 2001/02/25 22:25:05 oetiker
- * Initial revision
+ * Revision 1.2 2001/03/04 10:29:20 oetiker
+ * fixed filedescriptor leak
+ * -- Mike Franusich <mike@franusich.com>
+ *
+ * Revision 1.1.1.1 2001/02/25 22:25:05 oetiker
+ * checkin
*
*****************************************************************************/
#define MYFREAD(MYVAR,MYVART,MYCNT) \
if ((MYVAR = malloc(sizeof(MYVART) * MYCNT)) == NULL) {\
rrd_set_error("" #MYVAR " malloc"); \
+ fclose(*in_file); \
return (-1); } \
fread(MYVAR,sizeof(MYVART),MYCNT, *in_file);
if (strncmp(rrd->stat_head->cookie,RRD_COOKIE,4) != 0){
rrd_set_error("'%s' is not an RRD file",file_name);
free(rrd->stat_head);
+ fclose(*in_file);
return(-1);}
if (strncmp(rrd->stat_head->version,RRD_VERSION,5) != 0){
- rrd_set_error("cant handle RRD file version %s",
+ rrd_set_error("can't handle RRD file version %s",
rrd->stat_head->version);
free(rrd->stat_head);
+ fclose(*in_file);
return(-1);}
if (rrd->stat_head->float_cookie != FLOAT_COOKIE){
rrd_set_error("This RRD was created on other architecture");
free(rrd->stat_head);
+ fclose(*in_file);
return(-1);}
MYFREAD(rrd->ds_def, ds_def_t, rrd->stat_head->ds_cnt)