[Libreoffice] memory leaks found with valgrind

August Sodora augsod at gmail.com
Thu Nov 17 18:12:23 PST 2011


Hello,

I was a little curious about valgrind so I ran it against soffice and
found a few memory leaks. The two that I looked at are very minor but
I figured I'd try them to start with. The attached patch corrects the
first and the second I had difficulty understanding.

The first is caused by not calling XFreeGC when the splash screen closes:

==11027== 160 bytes in 1 blocks are definitely lost in loss record 7 of 8
==11027==    at 0x4A06031: malloc (vg_replace_malloc.c:236)
==11027==    by 0x3FA0A215EB: XCreateGC (CrGC.c:75)
==11027==    by 0x406480: splash_create_window (splashx.c:555)
==11027==    by 0x406E44: splash_create (splashx.c:781)
==11027==    by 0x4088D3: sal_main_with_args (start.c:850)
==11027==    by 0x408755: main (start.c:789)

So hooray we save 160 bytes. The second initially makes me think that
a matching XCloseDisplay is missing but I'm not sure why the call that
is already there isn't getting called if the first leak was fixed:

==11027== 124 bytes in 1 blocks are definitely lost in loss record 6 of 8
==11027==    at 0x4A06031: malloc (vg_replace_malloc.c:236)
==11027==    by 0x3FA060BD79: get_peer_sock_name (xcb_auth.c:259)
==11027==    by 0x3FA060BE45: _xcb_get_auth_info (xcb_auth.c:302)
==11027==    by 0x3FA060B84E: xcb_connect_to_display_with_auth_info
(xcb_util.c:424)
==11027==    by 0x3FA0A4CBC9: _XConnectXCB (xcb_disp.c:92)
==11027==    by 0x3FA0A34BAA: XOpenDisplay (OpenDis.c:166)
==11027==    by 0x406008: splash_create_window (splashx.c:503)
==11027==    by 0x406E44: splash_create (splashx.c:781)
==11027==    by 0x4088D3: sal_main_with_args (start.c:850)
==11027==    by 0x408755: main (start.c:789)

August Sodora
augsod at gmail.com
(201) 280-8138
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Valgrind-fixed-memory-leak.patch
Type: text/x-patch
Size: 911 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20111117/0ef4ebe0/attachment.bin>


More information about the LibreOffice mailing list