res_stasis_playback: Check for failure to append vector.
authorCorey Farrell <git@cfware.com>
Mon, 6 Nov 2017 23:38:35 +0000 (18:38 -0500)
committerCorey Farrell <git@cfware.com>
Mon, 6 Nov 2017 23:38:35 +0000 (18:38 -0500)
Free resources and return error if we fail to append the vector in
stasis_app_control_play_uri.

Change-Id: I22c4a90dd859b253f2850c6511de48b25609422b

res/res_stasis_playback.c

index c6f2136..ca0446b 100644 (file)
@@ -497,7 +497,11 @@ struct stasis_app_playback *stasis_app_control_play_uri(
 
            /* safe */
                strcpy(media_uri, media[i]);
-               AST_VECTOR_APPEND(&playback->medias, media_uri);
+               if (AST_VECTOR_APPEND(&playback->medias, media_uri)) {
+                       ao2_ref(playback, -1);
+                       ast_free(media_uri);
+                       return NULL;
+               }
        }
 
        if (skipms == 0) {