Re: Some memory leaks

Tobias Oetiker <[email protected]>
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <[email protected]>
Hi Christian,

makes sense ... thanks ... added.

cheers
tobi
Oct 17 Christian Magnusson wrote:

> 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))
>
>
>
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [email protected] ++41 62 775 9902 / sb: -9900
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.