[Poppler-bugs] [Bug 89951] New: Memory Leak in CairoFreeTypeFont::create

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Apr 7 23:20:17 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=89951

            Bug ID: 89951
           Summary: Memory Leak in CairoFreeTypeFont::create
           Product: poppler
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: medium
         Component: cairo backend
          Assignee: poppler-bugs at lists.freedesktop.org
          Reporter: jason at aquaticape.us

Created attachment 114943
  --> https://bugs.freedesktop.org/attachment.cgi?id=114943&action=edit
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)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler-bugs/attachments/20150408/89596761/attachment.html>


More information about the Poppler-bugs mailing list