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

This commit is contained in:
Joshua Colp
2017-11-07 07:14:15 -06:00
committed by Gerrit Code Review
9 changed files with 31 additions and 13 deletions

View File

@@ -622,7 +622,13 @@ int __ast_vasprintf(char **ret, const char *fmt, va_list ap, const char *file, i
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;
}