[Asterisk-code-review] res_ari_events: Add module reference when a WebSocket is open. (...asterisk[13])
Joshua Colp
asteriskteam at digium.com
Thu Oct 24 05:26:13 CDT 2019
Joshua Colp has uploaded this change for review. ( 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(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/03/13103/1
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-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191024/8590f92d/attachment.html>
More information about the asterisk-code-review
mailing list