commit 9f5404990ddc886d00624faf41d805f81857e1e3
Author:     Hiltjo Posthuma <hil...@codemadness.org>
AuthorDate: Tue Aug 4 23:12:03 2020 +0200
Commit:     Hiltjo Posthuma <hil...@codemadness.org>
CommitDate: Tue Aug 4 23:12:03 2020 +0200

    fixup strdup() from the last patch

diff --git a/svkbd.c b/svkbd.c
index 132a52d..15b5582 100644
--- a/svkbd.c
+++ b/svkbd.c
@@ -886,7 +886,6 @@ main(int argc, char *argv[]) {
 
        signal(SIGTERM, sigterm);
 
-
        /* parse environment variables */
        if (OVERLAYS <= 1) {
                enableoverlays = 0;
@@ -894,9 +893,9 @@ main(int argc, char *argv[]) {
                const char* enableoverlays_env = getenv("SVKBD_ENABLEOVERLAYS");
                if (enableoverlays_env != NULL) enableoverlays = 
atoi(enableoverlays_env);
        }
-       const char* layers_env = getenv("SVKBD_LAYERS");
+       char *layers_env = getenv("SVKBD_LAYERS");
        if (layers_env != NULL) {
-               if (!strdup(layer_names_list, layers_env)) {
+               if (!(layer_names_list = strdup(layers_env))) {
                        die("memory allocation error\n");
                }
        }
@@ -942,7 +941,7 @@ main(int argc, char *argv[]) {
                        if(i >= argc - 1)
                                continue;
                        free(layer_names_list);
-                       if (!strdup(layer_names_list, argv[++i])) {
+                       if (!(layer_names_list = strdup(argv[++i]))) {
                                die("memory allocation error\n");
                        }
                } else if(!strcmp(argv[i], "-s")) {

Reply via email to