summaryrefslogtreecommitdiff
path: root/res/ari
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2017-11-01 17:47:57 -0500
committerRichard Mudgett <rmudgett@digium.com>2017-11-03 13:14:07 -0500
commit79ddcdbc70d5e9580cb67b060efacf6d443b1e54 (patch)
treebee1308b45ddeb25bd10b8e4c6ff7b11f7b974d4 /res/ari
parent325b5dd30fe5ede5326ed96b448ee61dd5a51c2f (diff)
Stasis/ARI: Fix off-nominal path json memory leaks.
Change-Id: Id569c624c426e3b22a99936473c730592d8b83fb
Diffstat (limited to 'res/ari')
-rw-r--r--res/ari/resource_asterisk.c7
-rw-r--r--res/ari/resource_sounds.c1
2 files changed, 8 insertions, 0 deletions
diff --git a/res/ari/resource_asterisk.c b/res/ari/resource_asterisk.c
index e76eb02bc..5c6a35af6 100644
--- a/res/ari/resource_asterisk.c
+++ b/res/ari/resource_asterisk.c
@@ -433,6 +433,10 @@ void ast_ari_asterisk_list_modules(struct ast_variable *headers,
struct ast_json *json;
json = ast_json_array_create();
+ if (!json) {
+ ast_ari_response_alloc_failed(response);
+ return;
+ }
ast_update_module_list_data(&process_module_list, NULL, json);
ast_ari_response_ok(response, json);
@@ -505,6 +509,7 @@ void ast_ari_asterisk_get_module(struct ast_variable *headers,
ast_ari_response_error(
response, 409, "Conflict",
"Module information could not be retrieved");
+ ast_json_unref(json);
return;
}
@@ -667,10 +672,12 @@ void ast_ari_asterisk_list_log_channels(struct ast_variable *headers,
if (res == AST_LOGGER_FAILURE) {
ast_ari_response_error(response, 500, "Internal Server Error",
"Response body is not valid");
+ ast_json_unref(json);
return;
} else if (res == AST_LOGGER_ALLOC_ERROR) {
ast_ari_response_error(response, 500, "Internal Server Error",
"Allocation Failed");
+ ast_json_unref(json);
return;
}
diff --git a/res/ari/resource_sounds.c b/res/ari/resource_sounds.c
index 59ace5d81..2cb35b620 100644
--- a/res/ari/resource_sounds.c
+++ b/res/ari/resource_sounds.c
@@ -202,6 +202,7 @@ void ast_ari_sounds_list(struct ast_variable *headers,
if (!ast_json_array_size(sounds_blob)) {
ast_ari_response_error(response, 404, "Not Found", "No sounds found that matched the query");
+ ast_json_unref(sounds_blob);
return;
}