mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
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
This commit is contained in:
@@ -1457,6 +1457,10 @@ struct ast_channel *__ast_channel_internal_alloc(void (*destructor)(void *obj),
|
|||||||
tmp = ao2_alloc(sizeof(*tmp), destructor);
|
tmp = ao2_alloc(sizeof(*tmp), destructor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!tmp) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ast_string_field_init(tmp, 128))) {
|
if ((ast_string_field_init(tmp, 128))) {
|
||||||
return ast_channel_unref(tmp);
|
return ast_channel_unref(tmp);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user