summaryrefslogtreecommitdiff
path: root/src/arch/x86/operand.c
diff options
context:
space:
mode:
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;
}