Summary: | Memory Leak in CairoFreeTypeFont::create | ||
---|---|---|---|
Product: | poppler | Reporter: | Jason Crain <jason> |
Component: | cairo backend | Assignee: | poppler-bugs <poppler-bugs> |
Status: | RESOLVED DUPLICATE | QA Contact: | |
Severity: | minor | ||
Priority: | medium | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
PDF with embedded TrueType font
Free font's data->bytes in _ft_done_face |
Created attachment 114944 [details] [review] Free font's data->bytes in _ft_done_face Attached patch frees the font's bytes when the font is destroyed in _ft_done_face. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.
Created attachment 114943 [details] PDF with embedded TrueType font Attached file shows a memory leak when rendered with the following code : int main() { cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 20, 20); cairo_t *cr = cairo_create (surface); PopplerDocument *doc = poppler_document_new_from_file ("file:///home/jason/CairoTrueTypeFont.pdf", NULL, NULL); PopplerPage *page = poppler_document_get_page (doc, 0); poppler_page_render (page, cr); g_object_unref (page); g_object_unref (doc); cairo_destroy (cr); cairo_surface_destroy (surface); cairo_debug_reset_static_data (); } output of valgrind --tool=memcheck --leak-check=full --show-leak-kinds=definite ./a.out : ==19986== Warning: invalid file descriptor -1 in syscall close() ==19986== ==19986== HEAP SUMMARY: ==19986== in use at exit: 743,321 bytes in 5,522 blocks ==19986== total heap usage: 7,263 allocs, 1,741 frees, 169,459,456 bytes allocated ==19986== ==19986== 4,096 bytes in 1 blocks are definitely lost in loss record 498 of 506 ==19986== at 0x4C28C20: malloc (vg_replace_malloc.c:296) ==19986== by 0x65A63B8: gmalloc(unsigned long, bool) (gmem.cc:110) ==19986== by 0x65A6425: gmalloc (gmem.cc:120) ==19986== by 0x6496C04: Stream::toUnsignedChars(int*, int, int) (Stream.h:147) ==19986== by 0x64F6036: GfxFont::readEmbFontFile(XRef*, int*) (GfxFont.cc:908) ==19986== by 0x4E7F241: CairoFreeTypeFont::create(GfxFont*, XRef*, FT_LibraryRec_*, bool) (CairoFontEngine.cc:429) ==19986== by 0x4E8041E: CairoFontEngine::getFont(GfxFont*, PDFDoc*, bool, XRef*) (CairoFontEngine.cc:814) ==19986== by 0x4E82401: CairoOutputDev::updateFont(GfxState*) (CairoOutputDev.cc:631) ==19986== by 0x64EAE20: Gfx::opShowText(Object*, int) (Gfx.cc:3803) ==19986== by 0x64DAF6B: Gfx::execOp(Object*, Object*, int) (Gfx.cc:904) ==19986== by 0x64DA89C: Gfx::go(bool) (Gfx.cc:763) ==19986== by 0x64DA6D0: Gfx::display(Object*, bool) (Gfx.cc:729)