i3lock-color

The world's most popular non-default computer lockscreen.
Index Commits Files Refs README LICENSE
commit ef9d84128fca260b63806107368f9e081147da52
parent 1ecd26e59c969f410219e8446612f7da76bff1de
Author: Chris Guillott <chris@techfo.xyz>
Date:   Tue,  5 Dec 2017 13:27:43 -0500

fix some leaks; update lock.sh

Diffstat:
Mi3lock.c | 10++++++++--
Mlock.sh | 2+-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/i3lock.c b/i3lock.c
@@ -216,11 +216,15 @@ char* get_keylayoutname(int mode) {
 
     if (XkbGetNames(display, XkbGroupNamesMask, keyboard) != Success ) {
         DEBUG("Error obtaining symbolic names");
+        XCloseDisplay(display);
+        XkbFreeClientMap(keyboard, 0, true);
         return NULL;
     }
 
     if(XkbGetState(display, XkbUseCoreKbd, &state) != Success) {
         DEBUG("Error getting keyboard state");
+        XCloseDisplay(display);
+        XkbFreeClientMap(keyboard, 0, true);
         return NULL;
     }
 
@@ -258,10 +262,12 @@ char* get_keylayoutname(int mode) {
         default:
             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);
     // Free symbolic names structures
-    XkbFreeNames(keyboard, XkbGroupNamesMask, True);
-    // note: this is called in option parsing, so this debug() may not trigger unless --debug is the first option
+    XkbFreeClientMap(keyboard, 0, true);
+    XCloseDisplay(display);
+    display = NULL;
     return answer;
 }
 
diff --git a/lock.sh b/lock.sh
@@ -7,7 +7,7 @@ T='#ee00eeee'  # text
 W='#880000bb'  # wrong
 V='#bb00bbbb'  # verifying
 
-./i3lock              \
+./x86_64-pc-linux-gnu/i3lock \
 --insidevercolor=$C   \
 --ringvercolor=$V     \
 \