[Asterisk-code-review] res_ari: Fix wrong media uri handle for channel play (asterisk[18])

George Joseph asteriskteam at digium.com
Thu Dec 17 11:07:11 CST 2020


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15252 )

Change subject: res_ari: Fix wrong media uri handle for channel play
......................................................................

res_ari: Fix wrong media uri handle for channel play

Fixed wrong null object handle in
/channels/<channel_id>/play request handler.

ASTERISK-29188

Change-Id: I6691c640247a51ad15f23e4a203ca8430809bafe
---
M res/res_stasis_playback.c
1 file changed, 7 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c
index 7665d5f..d60a49a 100644
--- a/res/res_stasis_playback.c
+++ b/res/res_stasis_playback.c
@@ -489,6 +489,13 @@
 	for (i = 0; i < media_count; i++) {
 		char *media_uri;
 
+		if (ast_strlen_zero(media[i])) {
+			ast_log(LOG_ERROR, "Attempted to play media on channel '%s' but no media URI was provided.\n",
+				stasis_app_control_get_channel_id(control));
+			ao2_ref(playback, -1);
+			return NULL;
+		}
+
 		media_uri = ast_malloc(strlen(media[i]) + 1);
 	 	if (!media_uri) {
 			ao2_ref(playback, -1);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15252
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I6691c640247a51ad15f23e4a203ca8430809bafe
Gerrit-Change-Number: 15252
Gerrit-PatchSet: 2
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201217/9f0567b1/attachment.html>


More information about the asterisk-code-review mailing list