summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Simiklit <andrii.simiklit@globallogic.com>2018-09-06 17:43:53 +0300
committerEric Engestrom <eric.engestrom@intel.com>2018-09-06 17:33:27 +0100
commit65cfe698b0f4ba412198d212c14481a60c1b8389 (patch)
tree3353f859cea6a868a464679854cf28c1b520bf8a
parent570cacba7af165175ad40820c5e663db5b1c5066 (diff)
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@intel.com> Fixes: 864148d69e1e "util: add util_vasprintf() for Windows (v2)" Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
-rw-r--r--src/util/u_string.h2
1 files changed, 1 insertions, 1 deletions
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 */