summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/commands.h2
-rw-r--r--sway/commands.c8
-rw-r--r--sway/config.c7
-rw-r--r--sway/config/bar.c1
-rw-r--r--sway/input/keyboard.c3
-rw-r--r--sway/ipc-server.c12
-rw-r--r--sway/main.c3
-rw-r--r--sway/tree/container.c1
-rw-r--r--sway/tree/view.c2
-rw-r--r--sway/tree/workspace.c2
10 files changed, 30 insertions, 11 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h
index 7ca0bda8..6d17144a 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -79,7 +79,7 @@ void free_cmd_results(struct cmd_results *results);
79 * 79 *
80 * Free the JSON string later on. 80 * Free the JSON string later on.
81 */ 81 */
82const char *cmd_results_to_json(struct cmd_results *results); 82char *cmd_results_to_json(struct cmd_results *results);
83 83
84struct cmd_results *add_color(const char *name, 84struct cmd_results *add_color(const char *name,
85 char *buffer, const char *color); 85 char *buffer, const char *color);
diff --git a/sway/commands.c b/sway/commands.c
index 5b67e1ec..ef477f38 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -527,7 +527,7 @@ void free_cmd_results(struct cmd_results *results) {
527 free(results); 527 free(results);
528} 528}
529 529
530const char *cmd_results_to_json(struct cmd_results *results) { 530char *cmd_results_to_json(struct cmd_results *results) {
531 json_object *result_array = json_object_new_array(); 531 json_object *result_array = json_object_new_array();
532 json_object *root = json_object_new_object(); 532 json_object *root = json_object_new_object();
533 json_object_object_add(root, "success", 533 json_object_object_add(root, "success",
@@ -542,9 +542,9 @@ const char *cmd_results_to_json(struct cmd_results *results) {
542 } 542 }
543 json_object_array_add(result_array, root); 543 json_object_array_add(result_array, root);
544 const char *json = json_object_to_json_string(result_array); 544 const char *json = json_object_to_json_string(result_array);
545 free(result_array); 545 char *res = strdup(json);
546 free(root); 546 json_object_put(result_array);
547 return json; 547 return res;
548} 548}
549 549
550/** 550/**
diff --git a/sway/config.c b/sway/config.c
index 0aae1696..89b7d349 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -87,7 +87,12 @@ void free_config(struct sway_config *config) {
87 list_free(config->cmd_queue); 87 list_free(config->cmd_queue);
88 list_free(config->workspace_outputs); 88 list_free(config->workspace_outputs);
89 list_free(config->pid_workspaces); 89 list_free(config->pid_workspaces);
90 list_free(config->output_configs); 90 if (config->output_configs) {
91 for (int i = 0; i < config->output_configs->length; i++) {
92 free_output_config(config->output_configs->items[i]);
93 }
94 list_free(config->output_configs);
95 }
91 if (config->input_configs) { 96 if (config->input_configs) {
92 for (int i = 0; i < config->input_configs->length; i++) { 97 for (int i = 0; i < config->input_configs->length; i++) {
93 free_input_config(config->input_configs->items[i]); 98 free_input_config(config->input_configs->items[i]);
diff --git a/sway/config/bar.c b/sway/config/bar.c
index b97076a0..ee062c6a 100644
--- a/sway/config/bar.c
+++ b/sway/config/bar.c
@@ -30,6 +30,7 @@ void free_bar_config(struct bar_config *bar) {
30 if (!bar) { 30 if (!bar) {
31 return; 31 return;
32 } 32 }
33 free(bar->id);
33 free(bar->mode); 34 free(bar->mode);
34 free(bar->position); 35 free(bar->position);
35 free(bar->hidden_state); 36 free(bar->hidden_state);
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
index ec149d06..182536de 100644
--- a/sway/input/keyboard.c
+++ b/sway/input/keyboard.c
@@ -420,6 +420,9 @@ void sway_keyboard_destroy(struct sway_keyboard *keyboard) {
420 if (!keyboard) { 420 if (!keyboard) {
421 return; 421 return;
422 } 422 }
423 if (keyboard->keymap) {
424 xkb_keymap_unref(keyboard->keymap);
425 }
423 wl_list_remove(&keyboard->keyboard_key.link); 426 wl_list_remove(&keyboard->keyboard_key.link);
424 wl_list_remove(&keyboard->keyboard_modifiers.link); 427 wl_list_remove(&keyboard->keyboard_modifiers.link);
425 free(keyboard); 428 free(keyboard);
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 8cfd9f26..abdaa237 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -64,6 +64,10 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
64 close(ipc_socket); 64 close(ipc_socket);
65 unlink(ipc_sockaddr->sun_path); 65 unlink(ipc_sockaddr->sun_path);
66 66
67 while (ipc_client_list->length) {
68 struct ipc_client *client = ipc_client_list->items[0];
69 ipc_client_disconnect(client);
70 }
67 list_free(ipc_client_list); 71 list_free(ipc_client_list);
68 72
69 if (ipc_sockaddr) { 73 if (ipc_sockaddr) {
@@ -479,10 +483,10 @@ void ipc_client_handle_command(struct ipc_client *client) {
479 case IPC_COMMAND: 483 case IPC_COMMAND:
480 { 484 {
481 struct cmd_results *results = execute_command(buf, NULL); 485 struct cmd_results *results = execute_command(buf, NULL);
482 const char *json = cmd_results_to_json(results); 486 char *json = cmd_results_to_json(results);
483 char reply[256]; 487 int length = strlen(json);
484 int length = snprintf(reply, sizeof(reply), "%s", json); 488 client_valid = ipc_send_reply(client, json, (uint32_t)length);
485 client_valid = ipc_send_reply(client, reply, (uint32_t)length); 489 free(json);
486 free_cmd_results(results); 490 free_cmd_results(results);
487 goto exit_cleanup; 491 goto exit_cleanup;
488 } 492 }
diff --git a/sway/main.c b/sway/main.c
index 96e41bbc..ec7353be 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -1,6 +1,7 @@
1#define _XOPEN_SOURCE 700 1#define _XOPEN_SOURCE 700
2#define _POSIX_C_SOURCE 200112L 2#define _POSIX_C_SOURCE 200112L
3#include <getopt.h> 3#include <getopt.h>
4#include <pango/pangocairo.h>
4#include <signal.h> 5#include <signal.h>
5#include <stdbool.h> 6#include <stdbool.h>
6#include <stdlib.h> 7#include <stdlib.h>
@@ -441,5 +442,7 @@ int main(int argc, char **argv) {
441 free_config(config); 442 free_config(config);
442 } 443 }
443 444
445 pango_cairo_font_map_set_default(NULL);
446
444 return exit_value; 447 return exit_value;
445} 448}
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 3614d4e7..9093feba 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -151,6 +151,7 @@ void container_free(struct sway_container *cont) {
151 return; 151 return;
152 } 152 }
153 free(cont->name); 153 free(cont->name);
154 free(cont->formatted_title);
154 wlr_texture_destroy(cont->title_focused); 155 wlr_texture_destroy(cont->title_focused);
155 wlr_texture_destroy(cont->title_focused_inactive); 156 wlr_texture_destroy(cont->title_focused_inactive);
156 wlr_texture_destroy(cont->title_unfocused); 157 wlr_texture_destroy(cont->title_unfocused);
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 6b4daa82..bca8ef8a 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -514,7 +514,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
514 if (container_is_floating(focus)) { 514 if (container_is_floating(focus)) {
515 focus = focus->parent->parent; 515 focus = focus->parent->parent;
516 } 516 }
517 free(criterias); 517 list_free(criterias);
518 cont = container_view_create(focus, view); 518 cont = container_view_create(focus, view);
519 519
520 view->surface = wlr_surface; 520 view->surface = wlr_surface;
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 2db06a31..51f0fcb4 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -191,6 +191,8 @@ char *workspace_next_name(const char *output_name) {
191 free(target); 191 free(target);
192 target = _target; 192 target = _target;
193 wlr_log(L_DEBUG, "Workspace: Found free name %s", _target); 193 wlr_log(L_DEBUG, "Workspace: Found free name %s", _target);
194 } else {
195 free(_target);
194 } 196 }
195 } 197 }
196 free(dup); 198 free(dup);