[rrd-developers] Some memory leaks

Christian Magnusson mag at mag.cx
Sun Oct 17 17:14:28 CEST 2010


Hi all,

I tried to use librrd and update a remote rrd-database.
When rrdcached isn't started, librrd leak some memory.

Patch follows below...

/Christian


diff -ruw rrdtool-1.4.4.org/src/rrd_client.c
rrdtool-1.4.4/src/rrd_client.c
--- rrdtool-1.4.4.org/src/rrd_client.c	2010-06-30 14:48:47.000000000
+0200
+++ rrdtool-1.4.4/src/rrd_client.c	2010-10-13 08:58:46.000000000 +0200
@@ -504,6 +504,8 @@
     break;
   } /* for (ai_ptr) */
 
+  freeaddrinfo(ai_res);
+  
   return (status);
 } /* }}} int rrdc_connect_network */
 
diff -ruw rrdtool-1.4.4.org/src/rrd_update.c
rrdtool-1.4.4/src/rrd_update.c
--- rrdtool-1.4.4.org/src/rrd_update.c	2010-07-05 17:38:22.000000000
+0200
+++ rrdtool-1.4.4/src/rrd_update.c	2010-10-13 08:49:24.000000000 +0200
@@ -429,7 +429,10 @@
 
     {   /* try to connect to rrdcached */
         int status = rrdc_connect(opt_daemon);
-        if (status != 0) return status;
+		if (status != 0) {
+			rc = status;
+			goto out;
+		}
     }
 
     if ((tmplt != NULL) && rrdc_is_connected(opt_daemon))




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20101017/95865141/attachment.htm 


More information about the rrd-developers mailing list