diff options
author | Moazin Khatti <moazinkhatri@gmail.com> | 2019-06-24 00:27:39 +0500 |
---|---|---|
committer | Moazin Khatti <moazinkhatri@gmail.com> | 2019-07-11 14:09:43 +0500 |
commit | c9308ac1715da52ffe40cb59562088ddbe67ae25 (patch) | |
tree | 4b8a493ff4132d1b5ba78f0e0e4b57ea300a67b4 /src/sfnt/ttsvg.c | |
parent | 8f3634349851ae7160044bef352830e983b2cf2a (diff) | |
download | freetype2-c9308ac1715da52ffe40cb59562088ddbe67ae25.tar.gz |
Do proper memory freeing to prevent leaks.
* include/freetype/internal/ftobjs.h: Create a new flag named
`FT_GLYPH_OWN_GZIP_SVG' to indicate that `svg_document' in
`slot->other' is GZIP compressed and has to be freed later.
* src/base/ftglyph.c: Minor styling.
* src/base/ftobjs.c: Add code to free memory that was previously
allocated for storing GZIP compressed SVG documents.
* src/sfnt/ttsvg.c: Set the `FT_GLYPH_OWN_GZIP_SVG' flag if the
document is GZIP compressed.
Diffstat (limited to 'src/sfnt/ttsvg.c')
-rw-r--r-- | src/sfnt/ttsvg.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sfnt/ttsvg.c b/src/sfnt/ttsvg.c index 4ec3b2dc3..d9ad75a1d 100644 --- a/src/sfnt/ttsvg.c +++ b/src/sfnt/ttsvg.c @@ -26,6 +26,7 @@ #include <ft2build.h> #include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_OBJECTS_H #include FT_TRUETYPE_TAGS_H #include FT_GZIP_H #include FT_SVG_RENDERER_H @@ -214,8 +215,8 @@ (FT_ULong)doc_list[doc_length - 3] << 8 | (FT_ULong)doc_list[doc_length - 4]; - /* TODO: (OT-SVG) memory allocated here needs to be freed somewhere */ uncomp_buffer = (FT_Byte*) memory->alloc(memory, uncomp_size); + glyph->internal->flags |= FT_GLYPH_OWN_GZIP_SVG; error = FT_Gzip_Uncompress( memory, uncomp_buffer, &uncomp_size, doc_list, doc_length ); if ( error != FT_Err_Ok ) |