Bug#290538: libpango1.0-dev: memory leak in pango_layout_get_extents()
Sam Bromley
Sam Bromley <sam@sambromley.com>, 290538@bugs.debian.org
Fri, 14 Jan 2005 14:48:31 -0330
Subject: libpango1.0-dev: memory leak in pango_layout_get_extents()
Package: libpango1.0-dev
Version: 1.6.0-3
Severity: important
*** Please type your report below this line ***
The following code snippet demonstrates the memory leak.
Defining DO_LEAK enables the leak:
-----------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <pango/pango.h>
#include <pango/pangoft2.h>
int main(int argc, char *argv[])
{
PangoContext *context;
PangoFontMap *fontmap=NULL;
PangoLayout *layout;
int dpi = 96;
g_type_init();
if (g_file_test("./pangorc", G_FILE_TEST_EXISTS))
putenv("PANGO_RC_FILE=./pangorc");
while (1)
{
/* create a font map */
fontmap = pango_ft2_font_map_new();
pango_ft2_font_map_set_resolution(PANGO_FT2_FONT_MAP(fontmap),dpi,dpi);
/* create a context */
context =
pango_ft2_font_map_create_context(PANGO_FT2_FONT_MAP(fontmap));
/* free the fontmap */
g_object_unref(fontmap);
/* make a layout */
layout = pango_layout_new(context);
#ifdef DO_LEAK
PangoRectangle logical_rect;
pango_layout_get_extents(layout, NULL, &logical_rect);
#endif
/* free the layout */
g_object_unref(layout);
/* free the context */
g_object_unref(context);
}
return EXIT_SUCCESS;
}
-------------------------------
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.7
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages libpango1.0-dev depends on:
ii libfontconfig1-dev 2.2.3-4 generic font configuration
library
ii libfreetype6-dev 2.1.7-2.3 FreeType 2 font engine,
developmen
ii libglib2.0-dev 2.4.8-1 Development files for the
GLib lib
ii libpango1.0-0 1.6.0-3 Layout and rendering of
internatio
ii libx11-dev 4.3.0.dfsg.1-8 X Window System protocol
client li
ii libxft-dev 2.1.2-6 FreeType-based font drawing
librar
ii libxrender-dev 0.8.3-7 X Rendering Extension
client libra
ii pkg-config 0.15.0-4 Manage compile and link
flags for
ii xlibs-dev 4.3.0.dfsg.1-8 X Window System client
library dev
-- no debconf information