diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 8 |
1 files changed, 4 insertions, 4 deletions
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 | ||
530 | const char *cmd_results_to_json(struct cmd_results *results) { | 530 | char *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 | /** |