Manpage of XkbGetMap

Morten Bøgeskov mb at dbc.dk
Sun Mar 2 01:37:24 PST 2014


Hello..

I ran into a little issue with the man page of XkbGetMap..
The only reference to free in the page is:
"To free the returned data, use XkbFreeClientMap."

however this program:

#include <X11/Xlib.h>
#include <X11/XKBlib.h>

int main(int argc, char * argv[]) {
  Display *dpy = XOpenDisplay(NULL);
  XkbDescPtr keyboard_map = XkbGetMap(dpy, XkbAllClientInfoMask,
XkbUseCoreKbd);
  //XkbFreeKeyboard(keyboard_map, 0, True);
  XkbFreeClientMap(keyboard_map, 0, True);
  XCloseDisplay(dpy);
}

compiled with:
gcc -o x11 x11.c `pkg-config --libs --cflags x11`

run with:
valgrind --leak-check=full ./x11

gives:
==22885== 72 bytes in 1 blocks are definitely lost in loss record 1 of 1
==22885==    at 0x4C29590: calloc (vg_replace_malloc.c:618)
==22885==    by 0x4EC19C0: XkbGetMap
(in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==22885==    by 0x40077C: main (in /home/bogeskov/x11)

However if you use XkbFreeKeyboard instead you get:
==22901== HEAP SUMMARY:
==22901==     in use at exit: 0 bytes in 0 blocks
==22901==   total heap usage: 96 allocs, 96 frees, 70,435 bytes
allocated


Could someone please bring the man page / reality into sync ;-)

Yours
-- 

Morten Bøgeskov




More information about the xorg mailing list