diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | win/tkWinFont.c | 18 |
2 files changed, 10 insertions, 12 deletions
@@ -1,3 +1,7 @@ +2007-10-23 Pat Thoyts <patthoyts@users.sourceforge.net> + + * win/tkWinFont.c: Fixed leak in CreateNamedFont spotted by das. + 2007-10-23 Daniel Steffen <das@users.sourceforge.net> * library/demos/combo.tcl: Aqua GOOBE. diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 69ae9f9..89b98a7 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinFont.c,v 1.33 2007/09/08 16:13:45 dkf Exp $ + * RCS: @(#) $Id: tkWinFont.c,v 1.34 2007/10/23 09:23:54 patthoyts Exp $ */ #include "tkWinInt.h" @@ -368,19 +368,13 @@ CreateNamedSystemFont( CONST char* name, HFONT hFont) { - TkFontAttributes *faPtr; - WinFont *fontPtr; + WinFont winfont; int r; - TkDeleteNamedFont(interp, tkwin, name); - - fontPtr = (WinFont *) ckalloc(sizeof(WinFont)); - InitFont(tkwin, hFont, 0, fontPtr); - faPtr = (TkFontAttributes*)ckalloc(sizeof(TkFontAttributes)); - memcpy(faPtr, &fontPtr->font.fa, sizeof(TkFontAttributes)); - r = TkCreateNamedFont(interp, tkwin, name, faPtr); - TkpDeleteFont((TkFont *)fontPtr); - ckfree((char *) fontPtr); + TkDeleteNamedFont(NULL, tkwin, name); + InitFont(tkwin, hFont, 0, &winfont); + r = TkCreateNamedFont(interp, tkwin, name, &winfont.font.fa); + TkpDeleteFont((TkFont *)&winfont); return r; } |