[Asterisk-code-review] res_ari_events: Add module reference when a WebSocket is open. (...asterisk[13])
Friendly Automation
asteriskteam at digium.com
Tue Oct 29 09:34:03 CDT 2019
Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/13103 )
Change subject: res_ari_events: Add module reference when a WebSocket is open.
......................................................................
res_ari_events: Add module reference when a WebSocket is open.
This change ensures that the module isn't unloaded when a
WebSocket is open. Previously it was possible to unload the
module manually or during shutdown which could cause a crash
when any active WebSockets were terminated.
ASTERISK-28585
Change-Id: I85c71ab112f99875b586419a34c08c8b34c14c5c
---
M res/res_ari_events.c
M rest-api-templates/res_ari_resource.c.mustache
2 files changed, 4 insertions(+), 0 deletions(-)
Approvals:
Sean Bright: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/res/res_ari_events.c b/res/res_ari_events.c
index 04c1c79..e30c637 100644
--- a/res/res_ari_events.c
+++ b/res/res_ari_events.c
@@ -150,6 +150,8 @@
RAII_VAR(struct ast_websocket *, s, ws_session, ast_websocket_unref);
RAII_VAR(struct ast_ari_websocket_session *, session, NULL, ao2_cleanup);
+ SCOPED_MODULE_USE(ast_module_info->self);
+
response = ast_calloc(1, sizeof(*response));
if (!response) {
ast_log(LOG_ERROR, "Failed to create response.\n");
diff --git a/rest-api-templates/res_ari_resource.c.mustache b/rest-api-templates/res_ari_resource.c.mustache
index 40e1855..6b6502e 100644
--- a/rest-api-templates/res_ari_resource.c.mustache
+++ b/rest-api-templates/res_ari_resource.c.mustache
@@ -198,6 +198,8 @@
struct ast_variable *path_vars = NULL;
{{/has_path_parameters}}
+ SCOPED_MODULE_USE(ast_module_info->self);
+
{{#has_parameters}}
response = ast_calloc(1, sizeof(*response));
if (!response) {
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13103
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I85c71ab112f99875b586419a34c08c8b34c14c5c
Gerrit-Change-Number: 13103
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191029/01d5b6bc/attachment.html>
More information about the asterisk-code-review
mailing list