diff options
author | Joshua Colp <jcolp@digium.com> | 2017-11-08 04:58:12 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-11-08 04:58:12 -0600 |
commit | d91d0e992d546ddc527af58d7850867500c8fbf9 (patch) | |
tree | faac126ad647089ad673618465a066602fafb34f /res/stasis/app.c | |
parent | 0129e396b2523de4349bdab95bdb69a77605adc9 (diff) | |
parent | 801094da7b82401ca456d43937ca51f3d7919356 (diff) |
Merge "res_stasis: Fix multiple leaks."
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 0b44bf3c6..a1ef5c0b6 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; } |