]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_ari: Fix wrong media uri handle for channel play
authorSungtae Kim <pchero21@gmail.com>
Tue, 1 Dec 2020 01:27:43 +0000 (02:27 +0100)
committerGeorge Joseph <gjoseph@digium.com>
Thu, 17 Dec 2020 17:06:48 +0000 (11:06 -0600)
Fixed wrong null object handle in
/channels/<channel_id>/play request handler.

ASTERISK-29188

Change-Id: I6691c640247a51ad15f23e4a203ca8430809bafe

res/res_stasis_playback.c

index 7665d5f664dd98292ef7374d65a23d01d44d2343..d60a49a519c2e7718a15e2ed482811db2ba21df2 100644 (file)
@@ -489,6 +489,13 @@ struct stasis_app_playback *stasis_app_control_play_uri(
        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);