diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-21 18:11:40 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-21 18:11:40 +0000 |
commit | 3ac4f666756277f3afb3c7c018a70558ddbff80b (patch) | |
tree | 98a2e53215362461eb1ef76bed00da2d1d733123 /include | |
parent | b14bdc5a1211fa53add7d87b9444b56576d6d2d8 (diff) |
don't do the memcpy inside of ast_strdupa if we know that __builtin_alloca
was not successful
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@8393 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/utils.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index 91f12c1e9..f16817b86 100644 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -387,10 +387,6 @@ char *_ast_strndup(const char *str, size_t len, const char *file, int lineno, co This macro will duplicate the given string. It returns a pointer to the stack allocatted memory for the new string. - - \note If this function fails to allocate memory on the stack, we do not make - any effort to prevent Asterisk from crashing. We will attempt to log an - error message, but Asterisk will crash shortly after. */ #define ast_strdupa(s) \ (__extension__ \ @@ -402,7 +398,9 @@ char *_ast_strndup(const char *str, size_t len, const char *file, int lineno, co ast_log(LOG_ERROR, "Stack Allocation Error in" \ "function '%s' at line '%d' of '%s'!\n", \ __PRETTY_FUNCTION__, __LINE__, __FILE__); \ - (char *) memcpy (__new, __old, __len); \ + else \ + memcpy (__new, __old, __len); \ + __new; \ })) #endif |