diff options
-rw-r--r-- | sway/commands.c | 4 | ||||
-rw-r--r-- | sway/config.c | 6 | ||||
-rw-r--r-- | sway/workspace.c | 15 |
3 files changed, 20 insertions, 5 deletions
diff --git a/sway/commands.c b/sway/commands.c index 42d6b173..ab24f6ae 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -105,6 +105,10 @@ static bool cmd_bindsym(struct sway_config *config, int argc, char **argv) { | |||
105 | xkb_keysym_t sym = xkb_keysym_from_name(split->items[i], XKB_KEYSYM_CASE_INSENSITIVE); | 105 | xkb_keysym_t sym = xkb_keysym_from_name(split->items[i], XKB_KEYSYM_CASE_INSENSITIVE); |
106 | if (!sym) { | 106 | if (!sym) { |
107 | sway_log(L_ERROR, "bindsym - unknown key %s", (char *)split->items[i]); | 107 | sway_log(L_ERROR, "bindsym - unknown key %s", (char *)split->items[i]); |
108 | list_free(binding->keys); | ||
109 | free(binding->command); | ||
110 | free(binding); | ||
111 | list_free(split); | ||
108 | return false; | 112 | return false; |
109 | } | 113 | } |
110 | xkb_keysym_t *key = malloc(sizeof(xkb_keysym_t)); | 114 | xkb_keysym_t *key = malloc(sizeof(xkb_keysym_t)); |
diff --git a/sway/config.c b/sway/config.c index be9f70c1..3a7f3904 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -28,6 +28,7 @@ static char *get_config_path() { | |||
28 | if (exists(temp)) { | 28 | if (exists(temp)) { |
29 | return temp; | 29 | return temp; |
30 | } | 30 | } |
31 | free(temp); | ||
31 | 32 | ||
32 | // Check XDG_CONFIG_HOME with fallback to ~/.config/ | 33 | // Check XDG_CONFIG_HOME with fallback to ~/.config/ |
33 | sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_HOME/sway/config"); | 34 | sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_HOME/sway/config"); |
@@ -54,6 +55,7 @@ static char *get_config_path() { | |||
54 | if (exists(temp)) { | 55 | if (exists(temp)) { |
55 | return temp; | 56 | return temp; |
56 | } | 57 | } |
58 | free(temp); | ||
57 | 59 | ||
58 | // Check XDG_CONFIG_DIRS | 60 | // Check XDG_CONFIG_DIRS |
59 | sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_DIRS"); | 61 | sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_DIRS"); |
@@ -70,6 +72,7 @@ static char *get_config_path() { | |||
70 | free_flat_list(paths); | 72 | free_flat_list(paths); |
71 | return temp; | 73 | return temp; |
72 | } | 74 | } |
75 | free(temp); | ||
73 | } | 76 | } |
74 | free_flat_list(paths); | 77 | free_flat_list(paths); |
75 | } | 78 | } |
@@ -83,6 +86,7 @@ static char *get_config_path() { | |||
83 | if (exists(temp)) { | 86 | if (exists(temp)) { |
84 | return temp; | 87 | return temp; |
85 | } | 88 | } |
89 | free(temp); | ||
86 | 90 | ||
87 | sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_HOME/i3/config"); | 91 | sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_HOME/i3/config"); |
88 | if (xdg_config_home == NULL) { | 92 | if (xdg_config_home == NULL) { |
@@ -106,6 +110,7 @@ static char *get_config_path() { | |||
106 | if (exists(temp)) { | 110 | if (exists(temp)) { |
107 | return temp; | 111 | return temp; |
108 | } | 112 | } |
113 | free(temp); | ||
109 | 114 | ||
110 | sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_DIRS"); | 115 | sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_DIRS"); |
111 | if (xdg_config_dirs != NULL) { | 116 | if (xdg_config_dirs != NULL) { |
@@ -120,6 +125,7 @@ static char *get_config_path() { | |||
120 | free_flat_list(paths); | 125 | free_flat_list(paths); |
121 | return temp; | 126 | return temp; |
122 | } | 127 | } |
128 | free(temp); | ||
123 | } | 129 | } |
124 | free_flat_list(paths); | 130 | free_flat_list(paths); |
125 | } | 131 | } |
diff --git a/sway/workspace.c b/sway/workspace.c index 60108752..180c8a66 100644 --- a/sway/workspace.c +++ b/sway/workspace.c | |||
@@ -31,7 +31,7 @@ char *workspace_next_name(void) { | |||
31 | char* target = malloc(strlen(args->items[1]) + 1); | 31 | char* target = malloc(strlen(args->items[1]) + 1); |
32 | strcpy(target, args->items[1]); | 32 | strcpy(target, args->items[1]); |
33 | while (*target == ' ' || *target == '\t') | 33 | while (*target == ' ' || *target == '\t') |
34 | target++; | 34 | target++; |
35 | 35 | ||
36 | // Make sure that the command references an actual workspace | 36 | // Make sure that the command references an actual workspace |
37 | // not a command about workspaces | 37 | // not a command about workspaces |
@@ -42,11 +42,15 @@ char *workspace_next_name(void) { | |||
42 | strcmp(target, "number") == 0 || | 42 | strcmp(target, "number") == 0 || |
43 | strcmp(target, "back_and_forth") == 0 || | 43 | strcmp(target, "back_and_forth") == 0 || |
44 | strcmp(target, "current") == 0) | 44 | strcmp(target, "current") == 0) |
45 | { | ||
46 | list_free(args); | ||
45 | continue; | 47 | continue; |
46 | 48 | } | |
47 | //Make sure that the workspace doesn't already exist | 49 | |
50 | //Make sure that the workspace doesn't already exist | ||
48 | if (workspace_find_by_name(target)) { | 51 | if (workspace_find_by_name(target)) { |
49 | continue; | 52 | list_free(args); |
53 | continue; | ||
50 | } | 54 | } |
51 | 55 | ||
52 | list_free(args); | 56 | list_free(args); |
@@ -54,6 +58,7 @@ char *workspace_next_name(void) { | |||
54 | sway_log(L_DEBUG, "Workspace: Found free name %s", target); | 58 | sway_log(L_DEBUG, "Workspace: Found free name %s", target); |
55 | return target; | 59 | return target; |
56 | } | 60 | } |
61 | list_free(args); | ||
57 | } | 62 | } |
58 | // As a fall back, get the current number of active workspaces | 63 | // As a fall back, get the current number of active workspaces |
59 | // and return that + 1 for the next workspace's name | 64 | // and return that + 1 for the next workspace's name |
@@ -77,7 +82,7 @@ swayc_t *workspace_create(const char* name) { | |||
77 | } | 82 | } |
78 | 83 | ||
79 | bool workspace_by_name(swayc_t *view, void *data) { | 84 | bool workspace_by_name(swayc_t *view, void *data) { |
80 | return (view->type == C_WORKSPACE) && | 85 | return (view->type == C_WORKSPACE) && |
81 | (strcasecmp(view->name, (char *) data) == 0); | 86 | (strcasecmp(view->name, (char *) data) == 0); |
82 | } | 87 | } |
83 | 88 | ||