1 |
From 841dc893ca67fe2d35fb2831d48556beb14ee454 Mon Sep 17 00:00:00 2001 |
2 |
From: Andrii Simiklit <andrii.simiklit@globallogic.com> |
3 |
Date: Thu, 6 Sep 2018 17:43:53 +0300 |
4 |
Subject: [PATCH 08/20] mesa/util: don't ignore NULL returned from 'malloc' |
5 |
|
6 |
We should exit from the function 'util_vasprintf' |
7 |
with error code -1 for case where 'malloc' |
8 |
returns NULL |
9 |
|
10 |
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> |
11 |
Fixes: 864148d69e1e "util: add util_vasprintf() for Windows (v2)" |
12 |
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com> |
13 |
(cherry picked from commit 65cfe698b0f4ba412198d212c14481a60c1b8389) |
14 |
--- |
15 |
src/util/u_string.h | 2 +- |
16 |
1 file changed, 1 insertion(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/src/util/u_string.h b/src/util/u_string.h |
19 |
index 374c00e0bc..fb43ed0afc 100644 |
20 |
--- a/src/util/u_string.h |
21 |
+++ b/src/util/u_string.h |
22 |
@@ -126,7 +126,7 @@ util_vasprintf(char **ret, const char *format, va_list ap) |
23 |
return -1; |
24 |
|
25 |
*ret = (char *) malloc(r + 1); |
26 |
- if (!ret) |
27 |
+ if (!*ret) |
28 |
return -1; |
29 |
|
30 |
/* Print to buffer */ |
31 |
-- |
32 |
2.18.0 |
33 |
|