<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.28.3">
</HEAD>
<BODY>
Hi all,<BR>
<BR>
I tried to use librrd and update a remote rrd-database.<BR>
When rrdcached isn't started, librrd leak some memory.<BR>
<BR>
Patch follows below...<BR>
<BR>
/Christian<BR>
<BR>
<BR>
diff -ruw rrdtool-1.4.4.org/src/rrd_client.c rrdtool-1.4.4/src/rrd_client.c<BR>
--- rrdtool-1.4.4.org/src/rrd_client.c        2010-06-30 14:48:47.000000000 +0200<BR>
+++ rrdtool-1.4.4/src/rrd_client.c        2010-10-13 08:58:46.000000000 +0200<BR>
@@ -504,6 +504,8 @@<BR>
break;<BR>
} /* for (ai_ptr) */<BR>
<BR>
+ freeaddrinfo(ai_res);<BR>
+ <BR>
return (status);<BR>
} /* }}} int rrdc_connect_network */<BR>
<BR>
diff -ruw rrdtool-1.4.4.org/src/rrd_update.c rrdtool-1.4.4/src/rrd_update.c<BR>
--- rrdtool-1.4.4.org/src/rrd_update.c        2010-07-05 17:38:22.000000000 +0200<BR>
+++ rrdtool-1.4.4/src/rrd_update.c        2010-10-13 08:49:24.000000000 +0200<BR>
@@ -429,7 +429,10 @@<BR>
<BR>
{ /* try to connect to rrdcached */<BR>
int status = rrdc_connect(opt_daemon);<BR>
- if (status != 0) return status;<BR>
+                if (status != 0) {<BR>
+                        rc = status;<BR>
+                        goto out;<BR>
+                }<BR>
}<BR>
<BR>
if ((tmplt != NULL) && rrdc_is_connected(opt_daemon))<BR>
<BR>
<BR>
<BR>
<BR>
</BODY>
</HTML>