[cairo-bugs] [Bug 105466] Memory leak in cairo_show_text

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Apr 1 02:48:07 UTC 2018


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

--- Comment #5 from loplrf <vgdoqd at gmail.com> ---
```
#include <cairo.h>

int main(int argc, char *argv[])
{
        cairo_surface_t *surf = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
100, 100);
        cairo_t *ctx = cairo_create(surf);
        cairo_set_source_rgb(ctx, 1., .6863, 0.);
        cairo_move_to(ctx, 0, 50);
        cairo_show_text(ctx, "Hello, Cairo!");
        cairo_destroy(ctx);
        cairo_surface_write_to_png(surf, "greeting.png");
        cairo_surface_destroy(surf);
        cairo_debug_reset_static_data();
        return 0;
}
```
and the log file created by Valgrind is
```
==17769== Memcheck, a memory error detector
==17769== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==17769== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==17769== Command: ./a.out
==17769== Parent PID: 7856
==17769== 
==17769== 
==17769== HEAP SUMMARY:
==17769==     in use at exit: 191,425 bytes in 2,593 blocks
==17769==   total heap usage: 5,111 allocs, 2,518 frees, 1,600,799 bytes
allocated
==17769== 
==17769== 128 bytes in 1 blocks are definitely lost in loss record 66 of 108
==17769==    at 0x482E37C: malloc (in
/usr/local/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==17769==    by 0x4C59026: ??? (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.8.0)
==17769==    by 0x4C548A6: FcConfigSubstituteWithPat (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.8.0)
==17769==    by 0x4C54965: FcConfigSubstitute (in
/usr/lib/i386-linux-gnu/libfontconfig.so.1.8.0)
==17769==    by 0x492A761: _cairo_ft_resolve_pattern (cairo-ft-font.c:3364)
==17769==    by 0x492A008: _cairo_ft_font_face_get_implementation
(cairo-ft-font.c:3054)
==17769==    by 0x48D2DF3: _cairo_toy_font_face_get_implementation
(cairo-toy-font-face.c:401)
==17769==    by 0x48B4DB6: cairo_scaled_font_create (cairo-scaled-font.c:1134)
==17769==    by 0x486DC15: _cairo_gstate_ensure_scaled_font
(cairo-gstate.c:1915)
==17769==    by 0x486DADC: _cairo_gstate_get_scaled_font (cairo-gstate.c:1787)
==17769==    by 0x4866292: _cairo_default_context_get_scaled_font
(cairo-default-context.c:1300)
==17769==    by 0x485AFBF: cairo_get_scaled_font (cairo.c:3348)
==17769== 
==17769== LEAK SUMMARY:
==17769==    definitely lost: 128 bytes in 1 blocks
==17769==    indirectly lost: 20 bytes in 1 blocks
==17769==      possibly lost: 0 bytes in 0 blocks
==17769==    still reachable: 191,149 bytes in 2,590 blocks
==17769==         suppressed: 128 bytes in 1 blocks
==17769== Reachable blocks (those to which a pointer was found) are not shown.
==17769== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==17769== 
==17769== For counts of detected and suppressed errors, rerun with: -v
==17769== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 1 from 1)
```

I'm using cairo-1.15.10 on Debian 9.4. Thanks :)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo-bugs/attachments/20180401/fcc9bf05/attachment.html>


More information about the cairo-bugs mailing list