summaryrefslogtreecommitdiff
path: root/src/arch/x86/operand.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-05-18 23:53:33 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-05-18 23:53:33 (GMT)
commitf7e5d077e0d62f8b8717c79616852c3e1009cfa6 (patch)
tree95c71183a51aea8e0f936a4d3fa9803760677673 /src/arch/x86/operand.c
parent4d0ff0c23862c242d533d9b2d34e8812ef99ad61 (diff)
Fixed various bugs in the last commit.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@65 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86/operand.c')
-rw-r--r--src/arch/x86/operand.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/arch/x86/operand.c b/src/arch/x86/operand.c
index 1424b3e..bb152f8 100644
--- a/src/arch/x86/operand.c
+++ b/src/arch/x86/operand.c
@@ -514,7 +514,10 @@ GArchOperand *g_x86_mod_rm_operand_new(const bin_t *data, off_t *pos, off_t len,
/* Vieille astuce de l'emplacement mémoire fixe ? */
if (is_x86_register_base_pointer(reg) && mod == 0x00)
+ {
+ free_x86_register(reg);
return g_imm_operand_new_from_data(MDS_32_BITS/* FIXME */, data, pos, len, SRE_LITTLE);
+ }
result = g_object_new(G_TYPE_X86_MOD_RM_OPERAND, NULL);
@@ -527,14 +530,14 @@ GArchOperand *g_x86_mod_rm_operand_new(const bin_t *data, off_t *pos, off_t len,
if (result->base == NULL) goto gxmron_error;
result->index = get_x86_register(size, (data[*pos] & 0x38) >> 3);
- if (result->base == NULL) goto gxmron_error;
+ if (result->index == NULL) goto gxmron_error;
result->scale = ((data[*pos] & 0xc0) >> 6);
if (is_x86_register_stack_pointer(result->index))
{
+ free_x86_register(result->index);
result->index = result->base;
- free_x86_register(result->base);
result->base = NULL;
}