summaryrefslogtreecommitdiff
path: root/main/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/utils.c')
-rw-r--r--main/utils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/main/utils.c b/main/utils.c
index f20ccd36e..dd7176295 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -2349,7 +2349,13 @@ int __ast_asprintf(const char *file, int lineno, const char *func, char **ret, c
va_list ap;
va_start(ap, fmt);
- 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;
}
va_end(ap);