From 85f0d28bf127580e7e92b57eaaca63e536cf9eab Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Tue, 28 Sep 1999 15:07:46 +0000 Subject: [PATCH] * fix for disposing font data because it can contain #0 chars --- rtl/inc/graph/graph.pp | 10 +++++++--- rtl/inc/graph/gtext.inc | 11 +++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/rtl/inc/graph/graph.pp b/rtl/inc/graph/graph.pp index 68e3e74f86..deb578ced5 100644 --- a/rtl/inc/graph/graph.pp +++ b/rtl/inc/graph/graph.pp @@ -2818,8 +2818,9 @@ end; {$endif testsave} { release memory allocated for fonts } for c := 1 to installedfonts do - If assigned(fonts[c].instr) Then - Freemem(fonts[c].instr,strlen(fonts[c].instr)); + with fonts[c] Do + If assigned(instr) Then + Freemem(instr,instrlength); { release memory allocated for modelist } list := ModeList; while assigned(list) do @@ -2876,7 +2877,10 @@ SetGraphBufSize { $Log$ - Revision 1.31 1999-09-28 13:56:25 jonas + Revision 1.32 1999-09-28 15:07:46 jonas + * fix for disposing font data because it can contain #0 chars + + Revision 1.31 1999/09/28 13:56:25 jonas * reordered some local variables (first 4 byte vars, then 2 byte vars etc) * font data is now disposed in exitproc, exitproc is now called diff --git a/rtl/inc/graph/gtext.inc b/rtl/inc/graph/gtext.inc index 52284c20c3..830a9920dd 100644 --- a/rtl/inc/graph/gtext.inc +++ b/rtl/inc/graph/gtext.inc @@ -65,7 +65,8 @@ pheader : TFHeader; { prefix header } offsets : TOffsetTable; widths : TWidthTable; - instr : pchar; + instrlength: longint; { length of instr, because instr can } + instr : pchar; { contain null characters } end; @@ -116,6 +117,7 @@ inc(installedfonts); fonts[installedfonts].name:=FontFileName; fonts[installedfonts].instr := nil; + fonts[installedfonts].instrlength := 0; InstallUserFont:=installedfonts; end; @@ -298,6 +300,7 @@ exit; end; fonts[b].instr:=FontData; + fonts[b].instrlength:=Counter+1; RegisterBGIfont:=b; end; end; @@ -707,6 +710,7 @@ exit; end; fonts[font].instr:=FontData; + fonts[font].instrLength:=Length+1; if not testfont(Prefix) then @@ -727,7 +731,10 @@ { $Log$ -Revision 1.6 1999-09-28 13:56:29 jonas +Revision 1.7 1999-09-28 15:07:47 jonas + * fix for disposing font data because it can contain #0 chars + +Revision 1.6 1999/09/28 13:56:29 jonas * reordered some local variables (first 4 byte vars, then 2 byte vars etc) * font data is now disposed in exitproc, exitproc is now called