Bug 80 - valgrind reports 0 byte leak
Summary: valgrind reports 0 byte leak
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xft (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Keith Packard
QA Contact:
Depends on:
Reported: 2003-04-30 15:41 UTC by Kjartan Maraas
Modified: 2011-10-15 17:14 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Description Kjartan Maraas 2003-04-30 15:41:16 UTC
I got this when running Xft from CVS and starting gnome-session in valgrind:

<kmaraas> ==25925==    at 0x4002A620: malloc (vg_replace_malloc.c:153)
<kmaraas> ==25925==    by 0x40D1A63D: XftFontLoadGlyphs (xftglyphs.c:578)
<kmaraas> ==25925==    by 0x40D17521: XftGlyphExtents (xftextent.c:57)
<kmaraas> ==25925==    by 0x40727D66: pango_xft_font_get_glyph_extents (pangoxft-font.c:589)
<kmaraas> ==25925==    by 0x40759056: pango_font_get_glyph_extents (fonts.c:1097)
<kmaraas> ==25925==    by 0x4383ACE2: set_glyph (basic-xft.c:89)
<kmaraas> ==25925==    by 0x4383AE88: basic_engine_shape (basic-xft.c:160)
<kmaraas> ==25925==    by 0x40768ED0: pango_shape (shape.c:47)
<kmaraas> ==25925==    by 0x407623CB: process_item (pango-layout.c:2575)
<kmaraas> ==25925==    by 0x4076280D: process_line (pango-layout.c:2735)
<kmaraas> ==25925==    by 0x40762F2B: pango_layout_check_lines (pango-layout.c:3005)
<kmaraas> ==25925==    by 0x4076170A: pango_layout_get_extents_internal (pango-layout.c:1882)
<kmaraas> ==25925==    by 0x4076195D: pango_layout_get_extents (pango-layout.c:2007)
<kmaraas> ==25925==    by 0x407619EA: pango_layout_get_pixel_extents (pango-layout.c:2030)
<kmaraas> ==25925==    by 0x805650A: calc_text_box (splash-widget.c:115)
<kmaraas> ==25925==    by 0x805701F: splash_widget_add_icon (splash-widget.c:510)
<kmaraas> ==25925==    by 0x8057172: splash_update (splash-widget.c:563)
<kmaraas> ==25925==    by 0x804FE2C: run_command_prop (manager.c:366)
<kmaraas> ==25925==    by 0x804FF64: run_command (manager.c:406)
<kmaraas> ==25925==    by 0x805022F: start_client (manager.c:560)
<owen> Thta's keithp's code :-)
<kmaraas> :)
<kmaraas> I found some invalid reads in gnome-session too
<owen> It might be interesting to create a tiny program like
<kmaraas> filed a bug, but that's markmc's area?
<owen>  a = malloc ();
<owen> Sorry
<owen>  int main ()
<owen> {
<owen>   char *a = malloc (0);
<owen>   a = malloc (0);
<owen>  a = malloc (0);
<owen>  return 0;
<owen> }
<owen> And see if valgrind thinks that leaks
<kmaraas> ==26062==    definitely lost: 0 bytes in 3 blocks.
<kmaraas> yes
<kmaraas> it does
<kmaraas> bug in valgrind? or just a corner case?
<owen> Let me check specs
<owen>  If the space cannot be allocated, a null pointer shall be returned. If the size of the space requested is 0, the behavior is implementation-defined: the value returned shall be either a null pointer or a unique pointer.
<owen> So, Xft bug
<owen> bugzilla.fontconfig.org
<kmaraas> ok
<owen> (The quote is from POSIX)
Comment 1 Keith Packard 2003-04-30 16:32:53 UTC
Looks like valgrind and malloc don't agree on the semantics for a zero byte
allocation.  I can patch Xft to not allocate any memory in that case.
Comment 2 Bugzilla Administrator 2003-05-16 19:32:11 UTC
Current CVS contains the patch.
Comment 3 Jeremy Huddleston Sequoia 2011-10-01 19:39:54 UTC
Mass update: Close all bugs resolved over one year ago.

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.