From: Andrii Simiklit <andrii.simik...@globallogic.com>

We should exit from the function 'util_vasprintf'
with error code -1 for case where 'malloc'
returns NULL

Reviewed-by: Eric Engestrom <eric.engest...@intel.com>
Fixes: 864148d69e1e "util: add util_vasprintf() for Windows (v2)"
Signed-off-by: Andrii Simiklit <andrii.simik...@globallogic.com>

---
 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 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 */
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to