mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
Refactor code and fix a reference leak
Refactor some channel blob publishing code to use ast_channel_publish_blob now that it is available and fix a JSON reference leak that was occurring during varset publishing. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -519,7 +519,6 @@ void ast_channel_publish_snapshot(struct ast_channel *chan)
|
||||
|
||||
void ast_channel_publish_varset(struct ast_channel *chan, const char *name, const char *value)
|
||||
{
|
||||
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
|
||||
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
|
||||
|
||||
ast_assert(name != NULL);
|
||||
@@ -533,14 +532,7 @@ void ast_channel_publish_varset(struct ast_channel *chan, const char *name, cons
|
||||
return;
|
||||
}
|
||||
|
||||
msg = ast_channel_blob_create(chan, ast_channel_varset_type(),
|
||||
ast_json_ref(blob));
|
||||
|
||||
if (!msg) {
|
||||
return;
|
||||
}
|
||||
|
||||
publish_message_for_channel_topics(msg, chan);
|
||||
ast_channel_publish_blob(chan, ast_channel_varset_type(), blob);
|
||||
}
|
||||
|
||||
void ast_publish_channel_state(struct ast_channel *chan)
|
||||
|
Reference in New Issue
Block a user