On Sat, 26 Feb 2011 16:45:13 +0100 Colomban Wendling <[email protected]> wrote:
> Le 26/02/2011 14:50, Frank Lanitz a écrit : > > On Sat, 26 Feb 2011 14:21:11 +0100 > > Colomban Wendling <[email protected]> wrote: > > > >> Le 26/02/2011 13:41, Frank Lanitz a écrit : > >>> On Wed, 23 Feb 2011 19:32:07 +0100 > >>> Colomban Wendling <[email protected]> wrote: > >>> > >>>> [./geanylatex/src/templates.c:47]: (error) Memory leak: template > >>>> > >>>> I also attach here the fixes I propose for them, if you're > >>>> interested. > >>> > >>> I'm afraid I don't see why this should be a memory leak. Can you > >>> please be so kind and go into more details to prevent similar > >>> cases in future? > >> It's a possible memory leak because you exit the function > >> conditionally after the allocation, but don't free it in this > >> branch: > >> > >> TemplateEntry *template = g_new0(TemplateEntry, 1); > >> gchar *tmp = NULL; > >> > >> /* Return if its not a searched file */ > >> if (g_str_has_suffix(file,".gtl") == FALSE) > >> /* Leak here! */ > >> return; > >> > >> /* ... */ > >> > >> g_free(template); > >> > >> So the easiest fix is to allocate the memory after the conditional > >> exit since it isn't used before. > > > > True. > > > > Ah... and now I see. You were not doing a patch against trunk of > > geanylatex. Its fixed already inside http://yaturl.net/2c80 > Oops, I didn't though main development don't go in > geany-plugins/geanylatex, sorry :/ > > However, I suggest you to do the allocation after the conditional exit > rather than before and freeing it if taking the branch, because > alloc/free is far from being a no-op ;) Yep, you are right. Will do this ;) Cheers, Frank -- http://frank.uvena.de/en/
pgpTvlJRMaBhJ.pgp
Description: PGP signature
_______________________________________________ Geany-devel mailing list [email protected] http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
