From 2aec833b07c1281b2e155bdf30c70587f11293bf Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 1 Dec 2001 06:15:58 +0000 Subject: [PATCH] Don't free EA when simplifying shift_op case. Not only is this code completely wrong (the ModRM byte definitely must be kept), but it had a memory leak too (it just freed the ea without calling expr_delete())! svn path=/trunk/yasm/; revision=367 --- modules/arch/x86/bytecode.c | 3 --- modules/arch/x86/x86bc.c | 3 --- src/arch/x86/bytecode.c | 3 --- src/arch/x86/x86bc.c | 3 --- 4 files changed, 12 deletions(-) diff --git a/modules/arch/x86/bytecode.c b/modules/arch/x86/bytecode.c index 8b0070e7..78edcb4a 100644 --- a/modules/arch/x86/bytecode.c +++ b/modules/arch/x86/bytecode.c @@ -503,9 +503,6 @@ x86_bc_parser_finalize_insn(x86_insn *insn) if (intnum_get_uint(num) == 1) { /* Use ,1 form: first copy ,1 opcode. */ insn->opcode[0] = insn->opcode[1]; - /* Delete ModRM, as it's no longer needed */ - xfree(ea); - insn->ea = (effaddr *)NULL; /* Delete Imm, as it's not needed */ expr_delete(imm->val); xfree(imm); diff --git a/modules/arch/x86/x86bc.c b/modules/arch/x86/x86bc.c index 8b0070e7..78edcb4a 100644 --- a/modules/arch/x86/x86bc.c +++ b/modules/arch/x86/x86bc.c @@ -503,9 +503,6 @@ x86_bc_parser_finalize_insn(x86_insn *insn) if (intnum_get_uint(num) == 1) { /* Use ,1 form: first copy ,1 opcode. */ insn->opcode[0] = insn->opcode[1]; - /* Delete ModRM, as it's no longer needed */ - xfree(ea); - insn->ea = (effaddr *)NULL; /* Delete Imm, as it's not needed */ expr_delete(imm->val); xfree(imm); diff --git a/src/arch/x86/bytecode.c b/src/arch/x86/bytecode.c index 8b0070e7..78edcb4a 100644 --- a/src/arch/x86/bytecode.c +++ b/src/arch/x86/bytecode.c @@ -503,9 +503,6 @@ x86_bc_parser_finalize_insn(x86_insn *insn) if (intnum_get_uint(num) == 1) { /* Use ,1 form: first copy ,1 opcode. */ insn->opcode[0] = insn->opcode[1]; - /* Delete ModRM, as it's no longer needed */ - xfree(ea); - insn->ea = (effaddr *)NULL; /* Delete Imm, as it's not needed */ expr_delete(imm->val); xfree(imm); diff --git a/src/arch/x86/x86bc.c b/src/arch/x86/x86bc.c index 8b0070e7..78edcb4a 100644 --- a/src/arch/x86/x86bc.c +++ b/src/arch/x86/x86bc.c @@ -503,9 +503,6 @@ x86_bc_parser_finalize_insn(x86_insn *insn) if (intnum_get_uint(num) == 1) { /* Use ,1 form: first copy ,1 opcode. */ insn->opcode[0] = insn->opcode[1]; - /* Delete ModRM, as it's no longer needed */ - xfree(ea); - insn->ea = (effaddr *)NULL; /* Delete Imm, as it's not needed */ expr_delete(imm->val); xfree(imm); -- 2.40.0