Merge "Fix ast_(v)asprintf() malloc failure usage conditions." into 13

This commit is contained in:
Jenkins2
2017-11-07 06:41:50 -06:00
committed by Gerrit Code Review
8 changed files with 31 additions and 12 deletions

View File

@@ -721,7 +721,13 @@ int _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, c
DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, -1);
if ((res = vasprintf(ret, fmt, ap)) == -1) {
res = vasprintf(ret, fmt, ap);
if (res < 0) {
/*
* *ret is undefined so set to NULL to ensure it is
* initialized to something useful.
*/
*ret = NULL;
MALLOC_FAILURE_MSG;
}