diff options
author | Drew DeVault <[email protected]> | 2018-07-06 08:43:33 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2018-07-06 08:43:33 -0700 |
commit | 817e847749240a0c04756c37c88dc554efc56c9e (patch) | |
tree | ef2a716f8ea06ce8bdc63d1a682901b24e5bfcf0 /sway/commands.c | |
parent | 55c54bb63b82ee75e1893b48b3ce18f7317c6199 (diff) | |
parent | b3c55dd909b070625c9bfcebcb89cb8463e2ffc9 (diff) |
Merge pull request #2206 from martinetd/leaks
Fix a bunch of leaks
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) { free(results); } -const char *cmd_results_to_json(struct cmd_results *results) { +char *cmd_results_to_json(struct cmd_results *results) { json_object *result_array = json_object_new_array(); json_object *root = json_object_new_object(); json_object_object_add(root, "success", @@ -542,9 +542,9 @@ const char *cmd_results_to_json(struct cmd_results *results) { } json_object_array_add(result_array, root); const char *json = json_object_to_json_string(result_array); - free(result_array); - free(root); - return json; + char *res = strdup(json); + json_object_put(result_array); + return res; } /** |