diff options
author | Corey Farrell <git@cfware.com> | 2017-11-06 18:21:53 -0500 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2017-11-07 11:24:48 -0500 |
commit | 801094da7b82401ca456d43937ca51f3d7919356 (patch) | |
tree | 82b0fa1871ffe9c577142db9b9dc233fb55aa147 /res/stasis/app.c | |
parent | 637b37fb980822f50966f5292a786d03a859cd89 (diff) |
res_stasis: Fix multiple leaks.
* res/stasis/app.c JSON passed to app_send needs to be released.
* res/stasis_message.c: objects leak if vector append fails.
Change-Id: I8dd5385b9f50a5cadf2b1d16efecffd6ddb4db4a
Diffstat (limited to 'res/stasis/app.c')
-rw-r--r-- | res/stasis/app.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/res/stasis/app.c b/res/stasis/app.c index b0bcf3c42..35b1b43eb 100644 --- a/res/stasis/app.c +++ b/res/stasis/app.c @@ -588,6 +588,7 @@ static int message_received_handler(const char *endpoint_id, struct ast_json *js { RAII_VAR(struct ast_endpoint_snapshot *, snapshot, NULL, ao2_cleanup); struct ast_json *json_endpoint; + struct ast_json *message; struct stasis_app *app = pvt; char *tech; char *resource; @@ -613,11 +614,15 @@ static int message_received_handler(const char *endpoint_id, struct ast_json *js return -1; } - app_send(app, ast_json_pack("{s: s, s: o, s: o, s: o}", + message = ast_json_pack("{s: s, s: o, s: o, s: o}", "type", "TextMessageReceived", "timestamp", ast_json_timeval(ast_tvnow(), NULL), "endpoint", json_endpoint, - "message", ast_json_ref(json_msg))); + "message", ast_json_ref(json_msg)); + if (message) { + app_send(app, message); + ast_json_unref(message); + } return 0; } |