From 1a1a187292d7aa10a07bf6de89ca088cc4675a9f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 15 Mar 2018 23:31:47 -0400 Subject: [PATCH] translate-all: Prevent null-pointer dereference possibility in tb_clean_internal() --- qemu/accel/tcg/translate-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu/accel/tcg/translate-all.c b/qemu/accel/tcg/translate-all.c index 17240b5d..f8da0a99 100644 --- a/qemu/accel/tcg/translate-all.c +++ b/qemu/accel/tcg/translate-all.c @@ -174,11 +174,11 @@ static void cpu_gen_init(struct uc_struct *uc) static void tb_clean_internal(struct uc_struct *uc, int i, void** lp) { - if (i == 0 || lp == 0) { + if (i == 0 || lp == NULL) { return; } - tb_clean_internal(uc, i-1, (void*)(((char*)*lp) + ((0 >> (i * V_L2_BITS)) & (V_L2_SIZE - 1)))); if (lp && *lp) { + tb_clean_internal(uc, i-1, (void*)(((char*)*lp) + ((0 >> (i * V_L2_BITS)) & (V_L2_SIZE - 1)))); g_free(*lp); } }