From 65cfe698b0f4ba412198d212c14481a60c1b8389 Mon Sep 17 00:00:00 2001 From: Andrii Simiklit Date: Thu, 6 Sep 2018 17:43:53 +0300 Subject: [PATCH] mesa/util: don't ignore NULL returned from 'malloc' We should exit from the function 'util_vasprintf' with error code -1 for case where 'malloc' returns NULL Reviewed-by: Eric Engestrom Fixes: 864148d69e1e "util: add util_vasprintf() for Windows (v2)" Signed-off-by: Andrii Simiklit --- src/util/u_string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/u_string.h b/src/util/u_string.h index 374c00e0bcb..fb43ed0afc3 100644 --- a/src/util/u_string.h +++ b/src/util/u_string.h @@ -126,7 +126,7 @@ util_vasprintf(char **ret, const char *format, va_list ap) return -1; *ret = (char *) malloc(r + 1); - if (!ret) + if (!*ret) return -1; /* Print to buffer */ -- 2.30.2