> Found via Valgrind and a one-button "hello" program. In 
> Fl_x.cxx, fl_init_xim() allocates an XIM object using a call 
> to libx11. fl_init_xim() only deallocates that object in some 
> cases, rather than in all. It looks like the object is not 
> needed after fl_ini_xim(), so it should be deallocated locally.
> 
> Patch:
> 
> 540c541
> <   XIMStyles *xim_styles;
> ---
> >   XIMStyles *xim_styles = NULL;
> 569a571,575
> >
> >   if (xim_styles) {
> >     XFree(xim_styles);
> >   }

Thanks, that looks like a good catch, though I have some questions;

Initialising xim_styles to NULL is actually done in the body code at
present, so doing it at declaration is probably not adding much.

Does Xfree set things it releases to NULL? I don't remember for sure but
I think not, in which case we'd maybe need to explicitly set xim_styles
= NULL; after the Xfree at line 567, I suppose, (and maybe in other
places?) to be sure of avoiding a possible double-free from the proposed
patch?

Do we need to test-and-free-if-set xim_styles at around line 562 as
well?

Also (Denton) I think Unified diffs are generally preferred for patches,
so if you find any more can you post the patches in the unified style
please? Thanks again.



SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to