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.
Sorry about the phenomenal bug spam, guys. Adding xorg-team@ to the QA contact so bugs don't get lost in future.
*** Bug 20063 has been marked as a duplicate of this bug. ***
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"
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.