This is an attempt to resolve the potential leaks identified in fl_init_xim() by

Denton Thomas.
This is not quite the patch as he proposed it, but I *think* whay I have done
is OK.
Seems to be OK for me anyway... Needs testing by others of course!



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8278 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Ian MacArthur 2011-01-14 22:06:41 +00:00
parent 1a0b262f99
commit d87cc866fc

View File

@ -550,6 +550,8 @@ void fl_init_xim()
&xim_styles, NULL, NULL);
} else {
Fl::warning("XOpenIM() failed\n");
// if xim_styles is allocated, free it now
if(xim_styles) XFree(xim_styles);
return;
}
@ -559,14 +561,19 @@ void fl_init_xim()
Fl::warning("No XIM style found\n");
XCloseIM(fl_xim_im);
fl_xim_im = NULL;
// if xim_styles is allocated, free it now
if(xim_styles) XFree(xim_styles);
return;
}
if (!fl_xim_ic) {
Fl::warning("XCreateIC() failed\n");
XCloseIM(fl_xim_im);
XFree(xim_styles);
if(xim_styles) XFree(xim_styles);
xim_styles = NULL; // make sure we remember we have free'd xim_styles
fl_xim_im = NULL;
}
// if xim_styles is still allocated, free it now
if(xim_styles) XFree(xim_styles);
}
void fl_open_display() {