diff options
| author | Ian MacArthur <imacarthur@gmail.com> | 2011-01-14 22:06:41 +0000 |
|---|---|---|
| committer | Ian MacArthur <imacarthur@gmail.com> | 2011-01-14 22:06:41 +0000 |
| commit | d87cc866fc8e594f2ff31394be6b5ce225be6f39 (patch) | |
| tree | a895d706604760f14511eee3df1f2f8f8bc813fa | |
| parent | 1a0b262f992c774abc062356ded48082ed70fdf2 (diff) | |
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
| -rw-r--r-- | src/Fl_x.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 1de3b3cf2..da8be0ee9 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -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() { |
