Skip to content

Commit

Permalink
Patch from Tapani P?lli to fix a memory leak in X11_InitKeyboard
Browse files Browse the repository at this point in the history
Patch uses XkbFreeKeyboard to free the memory returned by XkbGetMap.
Earlier implementation called XkbFreeClientMap which frees all the maps
but not data->xkb structure itself, XkbFreeKeyboard will free maps and
the structure.
  • Loading branch information
slouken committed Nov 1, 2016
1 parent a1f4276 commit d0c8bf7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11keyboard.c
Expand Up @@ -484,7 +484,7 @@ X11_QuitKeyboard(_THIS)

#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
if (data->xkb) {
X11_XkbFreeClientMap(data->xkb, 0, True);
X11_XkbFreeKeyboard(data->xkb, 0, True);
data->xkb = NULL;
}
#endif
Expand Down
1 change: 1 addition & 0 deletions src/video/x11/SDL_x11sym.h
Expand Up @@ -179,6 +179,7 @@ SDL_X11_SYM(Status,XkbGetState,(Display* a,unsigned int b,XkbStatePtr c),(a,b,c)
SDL_X11_SYM(Status,XkbGetUpdatedMap,(Display* a,unsigned int b,XkbDescPtr c),(a,b,c),return)
SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b,c),return)
SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
SDL_X11_SYM(BOOL,XkbSetDetectableAutoRepeat,(Display* a, BOOL b, BOOL* c),(a,b,c),return)
#endif

Expand Down

0 comments on commit d0c8bf7

Please sign in to comment.