diff options
author | Matthew Jordan <mjordan@digium.com> | 2013-05-26 04:47:17 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2013-05-26 04:47:17 +0000 |
commit | fe3ca5401f2543bcc59d73de0ffd779112322d6c (patch) | |
tree | d4d7ee76fe9f3b032b7d40ef57861cecf93eeb12 /main/asterisk.c | |
parent | 97c6062dfc528d60c7115cca1a4a4e7c44c882f6 (diff) |
Fix a variety of memory corruption/assertion errors
* Initialize a Stasis-Core message type prior to initializing a caching topic.
The caching topic will attempt to use the message type.
* Don't attempt to publish Stasis-Core messages from remote console connections.
They aren't the main process; they shouldn't attempt to behave as it (they also
don't have the infrastructure to do so)
* Don't treat a JSON object as an ao2 object (whoops)
* In asterisk.c, ref bump the JSON even package that is distributed with the
event meta data. The callers assume that they own the reference, and the packing
routine steals references.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389785 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/asterisk.c')
-rw-r--r-- | main/asterisk.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/main/asterisk.c b/main/asterisk.c index 73d390fad..eb403e97f 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1140,6 +1140,7 @@ static void publish_system_message(const char *message_type, struct ast_json *ob return; } + ast_json_ref(obj); event_info = ast_json_pack("{s: s, s: i, s: o}", "type", message_type, "class_type", EVENT_FLAG_SYSTEM, @@ -2007,10 +2008,15 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart) } } active_channels = ast_active_channels(); - json_object = ast_json_pack("{s: s, s: s}", - "Shutdown", active_channels ? "Uncleanly" : "Cleanly", - "Restart", restart ? "True" : "False"); - publish_system_message("Shutdown", json_object); + /* Don't publish messages if we're a remote console - we won't have all of the Stasis + * topics or message types + */ + if (!ast_opt_remote) { + json_object = ast_json_pack("{s: s, s: s}", + "Shutdown", active_channels ? "Uncleanly" : "Cleanly", + "Restart", restart ? "True" : "False"); + publish_system_message("Shutdown", json_object); + } ast_verb(0, "Asterisk %s ending (%d).\n", active_channels ? "uncleanly" : "cleanly", num); |