diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2017-03-25 17:33:22 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2017-03-25 17:33:22 +0100 |
commit | ba2fe631679775cc5e25fe0e7b9769e7bc0e0f68 (patch) | |
tree | 5fd8e757de0acdf3a5c7b01f2e342b7f11886f48 /kxkb | |
parent | ec82c436506fd65e1acb3ebdfe8661b9682f4f8f (diff) | |
download | tdebase-ba2fe631679775cc5e25fe0e7b9769e7bc0e0f68.tar.gz tdebase-ba2fe631679775cc5e25fe0e7b9769e7bc0e0f68.zip |
Fix memory leak after use XGetAtomName
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'kxkb')
-rw-r--r-- | kxkb/kcmmisc.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/kxkb/kcmmisc.cpp b/kxkb/kcmmisc.cpp index 1687b1c81..358d10450 100644 --- a/kxkb/kcmmisc.cpp +++ b/kxkb/kcmmisc.cpp @@ -274,26 +274,27 @@ int xkb_init() && XkbQueryExtension( dpy, &xkb_opcode, &xkb_event, &xkb_error, &xkb_lmaj, &xkb_lmin ); } - + unsigned int xkb_mask_modifier( XkbDescPtr xkb, const char *name ) - { +{ int i; if( !xkb || !xkb->names ) return 0; - for( i = 0; - i < XkbNumVirtualMods; - i++ ) - { + for( i = 0; i < XkbNumVirtualMods; i++ ) { char* modStr = XGetAtomName( xkb->dpy, xkb->names->vmods[i] ); - if( modStr != NULL && strcmp(name, modStr) == 0 ) - { + if( modStr == NULL ) { + continue; + } + if( strcmp(name, modStr) == 0 ) { unsigned int mask; XkbVirtualModsToReal( xkb, 1 << i, &mask ); + XFree(modStr); return mask; - } } - return 0; + XFree(modStr); } + return 0; +} unsigned int xkb_numlock_mask() { |