Re: gdef memory leaks



On Sat, 2004-01-03 at 05:14, Masatake YAMATO wrote:
> I hope my patch fixes two memory leaks if gdef.
> 
> 1. gdef allocated in TT_New_GDEF_Table
> 
>   if ( ALLOC( gdef, sizeof( *gdef ) ) )
>       return error;
> 
> 2. memory allocated in TT_GDEF_Build_ClassDefinition
>    It seems that the memory allocated in TT_GDEF_Build_ClassDefinition
>    are expected to be freed in Free_ClassDefinition in ftxopen.c.
>    However, the memory will not be freed because cd->loaded is
>    always false.
> 
>       void  Free_ClassDefinition( TTO_ClassDefinition*  cd,
> 				  FT_Memory             memory )
>       {
> 	if ( !cd->loaded )
> 	  return;
> 
>    I suppose cd->loaded should be set TRUE in TT_GDEF_Build_ClassDefinition.

Can I ask you to put this patch into bugzilla.gnome.org? It will
be easier for me to handle it that way.

> These leaks are found by memprof.
> efence also reports another problem.

What?

Thanks,
						Owe

> Regards,
> Masatake YAMATO
> 
> 2004-01-03  Masatake YAMATO  <jet gyve org>
> 
> 	* pango/opentype/ftxgdef.c (TT_New_GDEF_Table): Free gdef.
> 	(TT_GDEF_Build_ClassDefinition): Set gcd->loaded TRUE if
> 	the execution is successful.
> 
> 
> Index: pango/opentype/ftxgdef.c
> ===================================================================
> RCS file: /cvs/gnome/pango/pango/opentype/ftxgdef.c,v
> retrieving revision 1.10
> diff -u -r1.10 ftxgdef.c
> --- pango/opentype/ftxgdef.c	1 Nov 2003 15:02:17 -0000	1.10
> +++ pango/opentype/ftxgdef.c	3 Jan 2004 09:49:36 -0000
> @@ -298,6 +298,8 @@
>      
>      Free_NewGlyphClasses( gdef, memory );
>  
> +    FREE( gdef );
> +    
>      return TT_Err_Ok;
>    }
>  
> @@ -1034,6 +1036,7 @@
>      gdef->MarkAttachClassDef_offset = 0L;
>      gdef->MarkAttachClassDef.loaded = FALSE;
>  
> +    gcd->loaded = TRUE;
>      return TT_Err_Ok;
>  
>    Fail1:
> _______________________________________________
> gtk-i18n-list mailing list
> gtk-i18n-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
> 
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]