[Asterisk-code-review] Check for ao2 alloc failure in ast channel internal alloc. (asterisk[master])

Corey Farrell asteriskteam at digium.com
Tue Apr 21 15:36:36 CDT 2015


Corey Farrell has uploaded a new change for review.

  https://gerrit.asterisk.org/190

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/90/190/1

diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index a2fafbf..4e85398 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -1449,6 +1449,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/190
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ca89189eb22f907408cb87d0a1645cfe1314a90
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>



More information about the asterisk-code-review mailing list