From: Andrii Simiklit Date: Thu, 6 Sep 2018 14:43:53 +0000 (+0300) Subject: mesa/util: don't ignore NULL returned from 'malloc' X-Git-Tag: upstream/19.0.0~2727 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=65cfe698b0f4ba412198d212c14481a60c1b8389;p=platform%2Fupstream%2Fmesa.git 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 --- diff --git a/src/util/u_string.h b/src/util/u_string.h index 374c00e..fb43ed0 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 */