Bug 7100 - XKeysymToString causes leaks for lookups of unnamed keys in Unicode range
Summary: XKeysymToString causes leaks for lookups of unnamed keys in Unicode range
Status: RESOLVED INVALID
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: 7.0 (2005.12)
Hardware: All All
: high major
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard: 2011BRB_Reviewed
Keywords: love
: 20063 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-03 00:27 UTC by Alan Coopersmith
Modified: 2018-06-12 19:07 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Alan Coopersmith 2006-06-03 00:27:26 UTC
The XKeysymToString man page says:
     The returned string is in a static area and must not be modified.

so no well-behaved other library or program ever calls free() on the returned
value.   However, if XKeysymToString can't find a keysym name and has to make
one up for a keycode in the range 0x01000100 - 0x0110ffff, then it mallocs a
new string, writes in a name and returns it.   Since it doesn't do anything
else, and the calling program doesn't know it needs to clean up, it will leak.
If it looks up the keysym multiple times, it will allocate new memory each time
and leak more memory each time.

Xlib should probably store the newly created name in it's hash table with other
keysyms, so that future lookups get the same pointer each time.
Comment 1 Daniel Stone 2007-02-27 01:32:21 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 2 Julien Cristau 2009-02-17 06:33:22 UTC
*** Bug 20063 has been marked as a duplicate of this bug. ***
Comment 3 Jeremy Huddleston Sequoia 2011-10-03 16:46:47 UTC
Bumping priority since this is a memory leak.  Pulling it into my queue.  This 
should be fairly straight forward to implement for anyone wanting to "jump in" 
to X11.
Comment 4 Adam Jackson 2018-06-12 19:07:26 UTC
Mass closure: This bug has been untouched for more than six years, and is not
obviously still valid. Please reopen this bug or file a new report if you continue to experience issues with current releases.


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.