Find a file
Pavel Labath 3f211616f6 Fix a leak in XCreateFontSet
a simple snippet like XFreeFontSet(d, XCreateFontSet(d, ...)) will generate lots of memory leaks,
as evidenced by the following valgrind output:
==983== HEAP SUMMARY:
==983==     in use at exit: 39,409 bytes in 341 blocks
==983==   total heap usage: 4,795 allocs, 4,454 frees, 489,086 bytes allocated
==983==
==983== 1,688 (136 direct, 1,552 indirect) bytes in 1 blocks are definitely lost in loss record
40 of 46
==983==    at 0x4C2B042: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==983==    by 0x56D5A93: add_codeset.clone.9 (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56D5FE0: load_generic (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56D7612: initialize (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56D7E75: _XlcCreateLC (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56F9A5F: _XlcUtf8Loader (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56DF815: _XOpenLC (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56B255A: XOpenOM (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56A665A: XCreateFontSet (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x4FCA80: conky::x11_output::create_gc() (x11.cc:746)
==983==    by 0x4FC3B4: conky::x11_output::use_own_window() (x11.cc:602)
==983==    by 0x4FAD42: conky::priv::own_window_setting::set(bool const&, bool) (x11.cc:92)
==983==
==983== LEAK SUMMARY:
==983==    definitely lost: 136 bytes in 1 blocks
==983==    indirectly lost: 1,552 bytes in 34 blocks
==983==      possibly lost: 0 bytes in 0 blocks
==983==    still reachable: 37,721 bytes in 306 blocks
==983==         suppressed: 0 bytes in 0 blocks

This patch makes the leak dissappear (Well, at least the "definitely lost part". The "still
reachable" thingy remains). After some analysis, I've discovered that the XLCd structure is
destroyed improperly. The "constructor" is in lcGeneric.c, but the structure is destroyed using
code from lcPublic.c. I've found that changing the destructor call to _XlcDestroyLC executes the
correct code path, and I'm pretty sure this is correct (the object was constructed using
_XlcCreateLC, it make sense to destroy it using its conterpart).

So far I haven't observed any strange behaviour on my system caused by this change (although, I'm
not sure, how many programs actually use this function).

Signed-off-by: Pavel Labath <pavelo@centrum.sk>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-06-09 09:52:32 -07:00
include Xlib.h: Fix macros imitating C functions. 2016-02-03 22:11:38 -08:00
m4 Revert “Dolt-ify" 2010-09-13 05:27:41 -04:00
man Add missing close paren to XrmGetStringDatabase synopsis in man page 2019-03-09 21:05:13 -08:00
modules Braille: Fix typing quickly 2019-06-07 23:39:22 +02:00
nls locale.alias.pre - add the de_IT locale 2019-03-16 08:49:47 -07:00
specs specs/XKB: Fix misprint in documentation of XkbFreeGeomOverlayKeys() 2019-02-23 11:43:51 -08:00
src Fix a leak in XCreateFontSet 2019-06-09 09:52:32 -07:00
.gitignore Ignore test-driver (used by newer autoconf). 2015-07-19 23:01:05 +02:00
AUTHORS libX11 1.5.0 2012-06-01 23:37:09 -07:00
autogen.sh autogen: add default patch prefix 2017-01-26 13:52:49 +10:00
configure.ac Use EXEEXT_FOR_BUILD for makekeys 2019-06-08 23:58:16 +00:00
COPYING Bug 19379 - Provide docs with overview of all compose key combinations 2010-09-21 18:22:21 -07:00
cpprules.in Restore lost tabs in sed commands 2014-05-23 17:27:10 -07:00
docbook.am docbook.am: embed css styles inside the HTML HEAD element 2011-12-30 17:08:14 -05:00
Makefile.am Update README for gitlab migration 2018-11-19 21:26:23 -08:00
NEWS Move security fixes to the top of NEWS, and fix spacing. 2007-06-03 21:41:47 -07:00
README.md Update README for gitlab migration 2018-11-19 21:26:23 -08:00
x11-xcb.pc.in Split public Xlib/XCB functions into libX11-xcb 2006-10-05 17:44:22 -07:00
x11.pc.in Bug 15664: xau & xdmcp not needed in x11.pc dependencies when built with xcb 2009-03-12 17:11:42 -07:00

libX11 - Core X11 protocol client library

Documentation for this library can be found in the included man pages, and in the Xlib spec from the specs subdirectory, also available at:

https://www.x.org/releases/current/doc/libX11/libX11/libX11.html https://www.x.org/releases/current/doc/libX11/libX11/libX11.pdf

and the O'Reilly Xlib books, which they have made freely available online, though only for older versions of X11:

All questions regarding this software should be directed at the Xorg mailing list:

https://lists.x.org/mailman/listinfo/xorg

The master development code repository can be found at:

https://gitlab.freedesktop.org/xorg/lib/libX11

Please submit bug reports and requests to merge patches there.

For patch submission instructions, see:

https://www.x.org/wiki/Development/Documentation/SubmittingPatches