>
> > Found via Valgrind and a one-button "hello" program. In=20
> > Fl_x.cxx, fl_init_xim() allocates an XIM object using a call=20
> > to libx11. fl_init_xim() only deallocates that object in some=20
> > cases, rather than in all. It looks like the object is not=20
> > needed after fl_ini_xim(), so it should be deallocated locally.
> >=20
> > Patch:
> >=20
> > 540c541
> > <   XIMStyles *xim_styles;
> > ---
> > >   XIMStyles *xim_styles =3D 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
> =3D 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 SS=
> 14 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.
> ********************************************************************
>

Hello, Ian - just rec'd this message and next. I'll opt for unified diffs in 
the future.

Agreed, setting to NULL at declaration is pointless! Line 546 is fine.

Also agreed that it is smart to check xim_styles before use, and to set it to 
NULL after. The xlib doc does not specify whether XFree will or won't set 
incoming values to NULL. Probably safer.


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to