[rrd-developers] fd leak patch

Tobias Oetiker oetiker at ee.ethz.ch
Tue Apr 18 23:06:16 MEST 2000


Folks,

there is a fd leak in connection with lazy mode:

--- rrd_graph.c~        Sun Apr 16 22:36:21 2000
+++ rrd_graph.c Tue Apr 18 23:00:54 2000
@@ -2277,6 +2277,7 @@
 
 int lazy_check(image_desc_t *im){
     FILE *fd = NULL;
+    int size = 1;
     struct stat  gifstat;
     
     if (im->lazy == 0) return 0; /* no lazy option */
@@ -2291,12 +2292,12 @@
       return 0; /* the file does not exist */
     switch (im->imgformat) {
     case IF_GIF:
-       return GifSize(fd,&(im->xgif),&(im->ygif));
+       size = GifSize(fd,&(im->xgif),&(im->ygif));
     case IF_PNG:
-       return PngSize(fd,&(im->xgif),&(im->ygif));
+       size = PngSize(fd,&(im->xgif),&(im->ygif));
     }
     fclose(fd);
-    return 1;
+    return size;
 }
 
fixes it ...

cheers
tobi

PS: Thanks to Edouard Lagache and Wim Holemans for helping with this one 

-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker, Timelord & SysMgr @ EE-Dept ETH-Zurich
 / // _ \/ _ \/ / TEL: +41(0)1-6325286  FAX:...1517  ICQ: 10419518 
/_/ \.__/_.__/_/ oetiker at ee.ethz.ch http://ee-staff.ethz.ch/~oetiker



--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers



More information about the rrd-developers mailing list