[Asterisk-code-review] Fixed null string trailing after AsyncAGIEnd AMI event (asterisk[master])
sungtae kim
asteriskteam at digium.com
Wed Jan 24 19:57:42 CST 2018
sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/8047
Change subject: Fixed null string trailing after AsyncAGIEnd AMI event
......................................................................
Fixed null string trailing after AsyncAGIEnd AMI event
Removed creating json_null() object for NULL data.
ASTERISK-27621
Change-Id: Ice58c16361f9d9e8648261c9ed5d6c8245fb0d8f
---
M main/stasis_channels.c
M main/stasis_message.c
2 files changed, 11 insertions(+), 9 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/47/8047/1
diff --git a/main/stasis_channels.c b/main/stasis_channels.c
index 8041c8e..382aacb 100644
--- a/main/stasis_channels.c
+++ b/main/stasis_channels.c
@@ -484,10 +484,13 @@
obj->snapshot = snapshot;
ao2_ref(obj->snapshot, +1);
}
- if (!blob) {
- blob = ast_json_null();
+
+ if (blob) {
+ obj->blob = ast_json_ref(blob);
}
- obj->blob = ast_json_ref(blob);
+ else {
+ obj->blob = NULL;
+ }
msg = stasis_message_create(type, obj);
ao2_cleanup(obj);
@@ -793,10 +796,6 @@
void ast_channel_publish_cached_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
{
struct stasis_message *message;
-
- if (!blob) {
- blob = ast_json_null();
- }
message = ast_channel_blob_create_from_cache(ast_channel_uniqueid(chan), type, blob);
if (message) {
diff --git a/main/stasis_message.c b/main/stasis_message.c
index 88db49f..556d534 100644
--- a/main/stasis_message.c
+++ b/main/stasis_message.c
@@ -109,7 +109,7 @@
{
struct stasis_message *message;
- if (type == NULL || data == NULL) {
+ if (type == NULL) {
return NULL;
}
@@ -121,7 +121,10 @@
message->timestamp = ast_tvnow();
ao2_ref(type, +1);
message->type = type;
- ao2_ref(data, +1);
+
+ if (data) {
+ ao2_ref(data, +1);
+ }
message->data = data;
if (eid) {
message->eid_ptr = &message->eid;
--
To view, visit https://gerrit.asterisk.org/8047
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice58c16361f9d9e8648261c9ed5d6c8245fb0d8f
Gerrit-Change-Number: 8047
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180124/bf15d3f0/attachment.html>
More information about the asterisk-code-review
mailing list