From 1a0b262f992c774abc062356ded48082ed70fdf2 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 14 Jan 2011 11:48:18 +0000 Subject: Fix memory leak in fl_new_ic() reported by Denton Thomas. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8277 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_x.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index e981faa93..1de3b3cf2 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -363,7 +363,6 @@ void fl_new_ic() XVaNestedList status_attr = NULL; static XFontSet fs = NULL; char *fnt; - bool must_free_fnt = true; char **missing_list; int missing_count; char *def_string; @@ -379,17 +378,18 @@ void fl_new_ic() #endif /*__GNUC__*/ if (!fs) { - fnt = NULL;//fl_get_font_xfld(0, 14); - if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;} + fnt = (char*)"-misc-fixed-*"; fs = XCreateFontSet(fl_display, fnt, &missing_list, &missing_count, &def_string); } #else if (!fs) { + bool must_free_fnt = true; fnt = fl_get_font_xfld(0, 14); if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;} fs = XCreateFontSet(fl_display, fnt, &missing_list, &missing_count, &def_string); + if (must_free_fnt) free(fnt); } #endif preedit_attr = XVaCreateNestedList(0, -- cgit v1.2.3