From 8b98ade31ed7994d6bcbb0600ad0ea3f3d881088 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Feb 2015 11:26:07 +0100 Subject: [PATCH] translate-all: Use g_try_malloc() for dynamic translator buffer The USE_MMAP code can fail, and the caller handles the failure already. Let the !USE_MMAP code fail as well, for consistency. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Gonglei Signed-off-by: Michael Tokarev --- translate-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translate-all.c b/translate-all.c index 4a1b64fd83..9f47ce7f71 100644 --- a/translate-all.c +++ b/translate-all.c @@ -631,7 +631,7 @@ static inline void *alloc_code_gen_buffer(void) #else static inline void *alloc_code_gen_buffer(void) { - void *buf = g_malloc(tcg_ctx.code_gen_buffer_size); + void *buf = g_try_malloc(tcg_ctx.code_gen_buffer_size); if (buf == NULL) { return NULL;