[Geany-devel] [Patch] memory leak in src/build.c

Frank Lanitz frank at xxxxx
Thu Sep 9 00:43:10 UTC 2010


Hi, 

On Wed, 8 Sep 2010 21:02:34 +0200
Daniel Marjamäki <daniel.marjamaki at gmail.com> wrote:

> I have another fix for a memory leak. Here is the code:
> 
> static void process_build_output_line(const gchar *str, gint color)
> {
> 	gchar *msg, *tmp;
> 	gchar *filename;
> 	gint line;
> 
> 	msg = g_strdup(str);
> 
> 	g_strchomp(msg);
> 
> 	if (! NZV(msg))
> 		return;
> .....
> 
> The patch:
> 
> Index: src/build.c
> ===================================================================
> --- src/build.c	(revision 5207)
> +++ src/build.c	(arbetskopia)
> @@ -996,7 +996,10 @@
>  	g_strchomp(msg);
> 
>  	if (! NZV(msg))
> +	{
> +		g_free(msg);
>  		return;
> +	}
> 
>  	if (build_parse_make_dir(msg, &tmp))
>  	{
> 


Thanks for the finding. I've committed to svn, but added a
NULL-check just to be sure. 

Thanks, 
Frank 
-- 
http://frank.uvena.de/en/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20100909/ce497af6/attachment.pgp>


More information about the Devel mailing list