View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000889 | luatex | luatex bug | public | 2014-02-16 22:01 | 2015-03-21 14:00 |
| Reporter | phg | Assigned To | Taco | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Summary | 0000889: memleak in fontloader.info() | ||||
| Description | When loading a font with fontloader.info() all of the SplineFont structure is not correctly deallocated. Can be fixed by adding further lines from SFFillFromTTF() to SFFillFromTTFInfo. | ||||
| Steps To Reproduce | #!/usr/bin/env texlua local main = function () local fontinfo = fontloader.info (arg [1] or os.exit(1)) return 0 end return main () | ||||
| Additional Information | The snippet above leaks 395 bytes if run on Iwona-Regular.otf (Luatex version 0.78.3, r4804). With the patch applied, both leaks are fixed. | ||||
| Tags | No tags attached. | ||||
|
|
parsettf.c-fontloader-info-memleak.patch (582 bytes)
Index: source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c
===================================================================
--- source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c (revision 4817)
+++ source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c (working copy)
@@ -6050,6 +6050,11 @@
sf->units_per_em = info->emsize ;
sf->pfminfo = info->pfminfo ;
+ free(info->savetab);
+ if ( sf->copyright==NULL )
+ sf->copyright = info->copyright;
+ else
+ free( info->copyright );
return( sf );
}
|
|
|
luafflib.c-fontloader-info-memleak.patch (638 bytes)
Index: source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
===================================================================
--- source/texk/web2c/luatexdir/luafontloader/src/luafflib.c (revision 4822)
+++ source/texk/web2c/luatexdir/luafontloader/src/luafflib.c (working copy)
@@ -3226,7 +3226,12 @@
fontname);
return 2;
}
+
+ gww_error_count = 0;
sf = ReadSplineFontInfo((char *) fontname, openflags);
+ if (gww_error_count > 0)
+ gwwv_errors_free();
+
if (sf == NULL) {
lua_pushnil(L);
lua_pushfstring(L, "font loading failed for %s\n", fontname);
|
|
|
There’s a second memory leak whenever fontloader.info() succeeded by a call to fontloader.open(). It is caused by the former not cleaning up Fontforge error messages after loading a font. To reproduce: ------------------------------------------------------------------------------- #!/usr/bin/env texlua local main = function () local fontname = arg [1] or os.exit(1) --[[ this leaks parts of the SplineFont ]] local fontinfo = fontloader.info (fontname) --[[ this leaks errors ]] local rawfont = fontloader.open (fontname) return 0 end return main () ------------------------------------------------------------------------------- See attached patch for luafflib.c |
|
|
both patches applied |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2014-02-16 22:01 | phg | New Issue | |
| 2014-02-16 22:01 | phg | File Added: parsettf.c-fontloader-info-memleak.patch | |
| 2014-02-18 06:15 | phg | File Added: luafflib.c-fontloader-info-memleak.patch | |
| 2014-02-18 06:19 | phg | Note Added: 0001224 | |
| 2014-02-18 06:20 | phg | Note Edited: 0001224 | |
| 2014-03-14 11:09 | Taco | Note Added: 0001248 | |
| 2014-03-14 11:09 | Taco | Status | new => resolved |
| 2014-03-14 11:09 | Taco | Resolution | open => fixed |
| 2014-03-14 11:09 | Taco | Assigned To | => Taco |
| 2015-03-21 14:00 | Hans Hagen | Status | resolved => closed |