diff options
author | patthoyts <patthoyts@noemail.net> | 2007-10-23 09:23:51 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@noemail.net> | 2007-10-23 09:23:51 (GMT) |
commit | fe102f6ea47737a28d411cb7b2e41f9d55c4c1d4 (patch) | |
tree | ddde12aa0e4ed1d49e5f1c3d0b21f5f73be78782 /win | |
parent | e3f86d263b1ae4e54510311fe5d60cfb80862542 (diff) | |
download | tk-fe102f6ea47737a28d411cb7b2e41f9d55c4c1d4.zip tk-fe102f6ea47737a28d411cb7b2e41f9d55c4c1d4.tar.gz tk-fe102f6ea47737a28d411cb7b2e41f9d55c4c1d4.tar.bz2 |
Fixed leak in CreateNamedFont spotted by das.
FossilOrigin-Name: 9dcfea84bc547f351ea4be05c066d7458f7a3de2
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinFont.c | 18 |
1 files changed, 6 insertions, 12 deletions
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; } |