Some memory leaks

Christian Magnusson <[email protected]>
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <1287328468.2151.1240.camel@maghp>
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))

_______________________________________________
rrd-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.