Mesa (staging/18.1): mesa/util: don't ignore NULL returned from 'malloc'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Sep 7 17:18:23 UTC 2018
Module: Mesa
Branch: staging/18.1
Commit: a17aed452da48632749b21fcd982ca99a5343ba9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a17aed452da48632749b21fcd982ca99a5343ba9
Author: Andrii Simiklit <andrii.simiklit at globallogic.com>
Date: Thu Sep 6 17:43:53 2018 +0300
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 <eric.engestrom at intel.com>
Fixes: 864148d69e1e "util: add util_vasprintf() for Windows (v2)"
Signed-off-by: Andrii Simiklit <andrii.simiklit at globallogic.com>
(cherry picked from commit 65cfe698b0f4ba412198d212c14481a60c1b8389)
---
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 374c00e0bc..fb43ed0afc 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 */
More information about the mesa-commit
mailing list