[asterisk-commits] Check for ao2 alloc failure in ast channel internal alloc. (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 22 05:45:20 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: Check for ao2_alloc failure in __ast_channel_internal_alloc.
......................................................................


Check for ao2_alloc failure in __ast_channel_internal_alloc.

Fix a crash that could occur in __ast_channel_internal_alloc if
ao2_alloc fails.

ASTERISK-24991 #close

Change-Id: I4ca89189eb22f907408cb87d0a1645cfe1314a90
---
M main/channel_internal_api.c
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified
  George Joseph: Looks good to me, but someone else must approve



diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 624bdd1..835b9ce 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -1457,6 +1457,10 @@
 	tmp = ao2_alloc(sizeof(*tmp), destructor);
 #endif
 
+	if (!tmp) {
+		return NULL;
+	}
+
 	if ((ast_string_field_init(tmp, 128))) {
 		return ast_channel_unref(tmp);
 	}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4ca89189eb22f907408cb87d0a1645cfe1314a90
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list