aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/commands.c12
-rw-r--r--sway/config.c2
-rw-r--r--sway/main.c1
3 files changed, 11 insertions, 4 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 2c1b2cb9..e2c43e9f 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -198,9 +198,6 @@ static void set_config_node(struct sway_node *node) {
198 198
199list_t *execute_command(char *_exec, struct sway_seat *seat, 199list_t *execute_command(char *_exec, struct sway_seat *seat,
200 struct sway_container *con) { 200 struct sway_container *con) {
201 list_t *res_list = create_list();
202 char *exec = strdup(_exec);
203 char *head = exec;
204 char *cmd; 201 char *cmd;
205 char matched_delim = ';'; 202 char matched_delim = ';';
206 list_t *views = NULL; 203 list_t *views = NULL;
@@ -213,9 +210,16 @@ list_t *execute_command(char *_exec, struct sway_seat *seat,
213 } 210 }
214 } 211 }
215 212
213 char *exec = strdup(_exec);
214 char *head = exec;
215 list_t *res_list = create_list();
216
217 if (!res_list || !exec) {
218 return NULL;
219 }
220
216 config->handler_context.seat = seat; 221 config->handler_context.seat = seat;
217 222
218 head = exec;
219 do { 223 do {
220 for (; isspace(*head); ++head) {} 224 for (; isspace(*head); ++head) {}
221 // Extract criteria (valid for this command list only). 225 // Extract criteria (valid for this command list only).
diff --git a/sway/config.c b/sway/config.c
index bb5b920b..afc60a42 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -687,8 +687,10 @@ static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file,
687 nread += next_nread - 2; 687 nread += next_nread - 2;
688 if ((ssize_t) *line_size < nread + 1) { 688 if ((ssize_t) *line_size < nread + 1) {
689 *line_size = nread + 1; 689 *line_size = nread + 1;
690 char *old_ptr = *lineptr;
690 *lineptr = realloc(*lineptr, *line_size); 691 *lineptr = realloc(*lineptr, *line_size);
691 if (!*lineptr) { 692 if (!*lineptr) {
693 free(old_ptr);
692 nread = -1; 694 nread = -1;
693 break; 695 break;
694 } 696 }
diff --git a/sway/main.c b/sway/main.c
index 177c0aa1..2cc69dfb 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -259,6 +259,7 @@ int main(int argc, char **argv) {
259 exit(EXIT_SUCCESS); 259 exit(EXIT_SUCCESS);
260 break; 260 break;
261 case 'c': // config 261 case 'c': // config
262 free(config_path);
262 config_path = strdup(optarg); 263 config_path = strdup(optarg);
263 break; 264 break;
264 case 'C': // validate 265 case 'C': // validate