- attempt to log an error message if the __builtin_alloca inside of ast_strdupa
fails.
- document the fact that it is known and intended behavior for ast_strdupa to
cause Asterisk to crash if the alloca fails
- use __builtin_expect when checking for allocation failure in all of the
allocation wrappers
New Janitor Project! Anywhere that we check for a successful allocation after
a call to ast_strdupa is unnecessary and should be removed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8356 65c4cc65-6c06-0410-ace0-fbb531ad65f3
ast_log(LOG_ERROR,"Memory Allocation Failure - Could not duplicate '%s' in function %s at line %d of %s\n",str,func,lineno,file);
}
@ -372,7 +372,7 @@ char *_ast_strndup(const char *str, size_t len, const char *file, int lineno, co
if(str){
newstr=strndup(str,len);
if(!newstr)
if(__builtin_expect(!newstr,0))
ast_log(LOG_ERROR,"Memory Allocation Failure - Could not duplicate '%d' bytes of '%s' in function %s at line %d of %s\n",(int)len,str,func,lineno,file);
}
@ -380,4 +380,30 @@ char *_ast_strndup(const char *str, size_t len, const char *file, int lineno, co