summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-11-07 06:41:50 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-11-07 06:41:50 -0600
commit37863c163c51a29b21871e0d05c62b268c1aaeb5 (patch)
tree4e1515eeadefa786a20afa18795b889020198782 /include
parent36b5a66c27582e0b54d5dababec93f78fc272f73 (diff)
parent9013415593868b2d31a895e3f1f209fc21b58384 (diff)
Merge "Fix ast_(v)asprintf() malloc failure usage conditions." into 13
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/utils.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 4a5dbf282..03705b321 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -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;
}