spoon

set dwm status
git clone git://git.2f30.org/spoon
Log | Files | Refs | LICENSE

commit 1c2f9b46506ce4a7dd2f32856b09f89dbe46ad93
parent f1a0d8b0257f582bbff7e326c395455af4742f0f
Author: sin <sin@2f30.org>
Date:   Sun, 15 May 2016 13:31:10 +0100

Free vd.options in case of failure

Diffstat:
Mspoon.c | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/spoon.c b/spoon.c @@ -109,11 +109,14 @@ xkblayoutread(char *buf, size_t len) return -1; } XkbGetState(dpy, XkbUseCoreKbd, &state); - XkbRF_GetNamesProp(dpy, &tmp, &vd); + if (XkbRF_GetNamesProp(dpy, &tmp, &vd) == 0){ + ret = -1; + goto out0; + } str = strdup(vd.layout); if (str == NULL) { ret = -1; - goto out0; + goto out1; } tok = strtok(str, ","); for (i = 0; i < state.group; i++) { @@ -121,12 +124,14 @@ xkblayoutread(char *buf, size_t len) if (tok == NULL) { warnx("cannot extract layout"); ret = -1; - goto out1; + goto out2; } } strlcpy(buf, tok, len); -out1: +out2: free(str); +out1: + XFree(vd.options); out0: XCloseDisplay(dpy); return ret;