Browse Source

fix some leaks; update lock.sh

master
Chris Guillott 7 years ago
parent
commit
ef9d84128f
  1. 10
      i3lock.c
  2. 2
      lock.sh

10
i3lock.c

@ -216,11 +216,15 @@ char* get_keylayoutname(int mode) {
if (XkbGetNames(display, XkbGroupNamesMask, keyboard) != Success ) { if (XkbGetNames(display, XkbGroupNamesMask, keyboard) != Success ) {
DEBUG("Error obtaining symbolic names"); DEBUG("Error obtaining symbolic names");
XCloseDisplay(display);
XkbFreeClientMap(keyboard, 0, true);
return NULL; return NULL;
} }
if(XkbGetState(display, XkbUseCoreKbd, &state) != Success) { if(XkbGetState(display, XkbUseCoreKbd, &state) != Success) {
DEBUG("Error getting keyboard state"); DEBUG("Error getting keyboard state");
XCloseDisplay(display);
XkbFreeClientMap(keyboard, 0, true);
return NULL; return NULL;
} }
@ -258,10 +262,12 @@ char* get_keylayoutname(int mode) {
default: default:
break; break;
} }
// note: this is called in option parsing, so this debug() may not trigger unless --debug is the first option
DEBUG("answer after mode parsing: [%s]\n", answer); DEBUG("answer after mode parsing: [%s]\n", answer);
// Free symbolic names structures // Free symbolic names structures
XkbFreeNames(keyboard, XkbGroupNamesMask, True); XkbFreeClientMap(keyboard, 0, true);
// note: this is called in option parsing, so this debug() may not trigger unless --debug is the first option XCloseDisplay(display);
display = NULL;
return answer; return answer;
} }

2
lock.sh

@ -7,7 +7,7 @@ T='#ee00eeee' # text
W='#880000bb' # wrong W='#880000bb' # wrong
V='#bb00bbbb' # verifying V='#bb00bbbb' # verifying
./i3lock \ ./x86_64-pc-linux-gnu/i3lock \
--insidevercolor=$C \ --insidevercolor=$C \
--ringvercolor=$V \ --ringvercolor=$V \
\ \

Loading…
Cancel
Save