[Asterisk-code-review] res stasis playback: Check for failure to append vector. (asterisk[15])

Joshua Colp asteriskteam at digium.com
Tue Nov 7 18:41:42 CST 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/7072 )

Change subject: res_stasis_playback: Check for failure to append vector.
......................................................................

res_stasis_playback: Check for failure to append vector.

Free resources and return error if we fail to append the vector in
stasis_app_control_play_uri.

Change-Id: I22c4a90dd859b253f2850c6511de48b25609422b
---
M res/res_stasis_playback.c
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  George Joseph: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, approved



diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c
index c6f2136..ca0446b 100644
--- a/res/res_stasis_playback.c
+++ b/res/res_stasis_playback.c
@@ -497,7 +497,11 @@
 
 	    /* 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) {

-- 
To view, visit https://gerrit.asterisk.org/7072
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I22c4a90dd859b253f2850c6511de48b25609422b
Gerrit-Change-Number: 7072
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171107/6e88db41/attachment.html>


More information about the asterisk-code-review mailing list