summaryrefslogtreecommitdiff
path: root/src/arch/instruction.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/instruction.c')
-rw-r--r--src/arch/instruction.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index c11f253..7e1e646 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -191,6 +191,10 @@ static void g_arch_instruction_dispose(GArchInstruction *instr)
rem_item_from_flat_array(&instr->operands, 0, sizeof(GArchOperand *));
+ /**
+ * Une fois pour l'obtention, une autre pour la libération !
+ */
+ g_object_unref(G_OBJECT(op));
g_object_unref(G_OBJECT(op));
}
@@ -564,7 +568,7 @@ GArchOperand *_g_arch_instruction_get_operand(const GArchInstruction *instr, siz
result = *ptr;
- /* TODO : incrémenter la référence ! */
+ g_object_ref(G_OBJECT(result));
return result;
@@ -635,6 +639,8 @@ bool _g_arch_instruction_replace_operand(GArchInstruction *instr, GArchOperand *
break;
}
+ g_object_unref(G_OBJECT(op));
+
}
if (result)
@@ -678,6 +684,8 @@ void _g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *t
if (op == target)
break;
+ g_object_unref(G_OBJECT(op));
+
}
rem_item_from_flat_array(&instr->operands, i, sizeof(GArchOperand *));
@@ -1192,6 +1200,7 @@ static void _g_arch_instruction_print(GArchInstruction *instr, GBufferLine *line
{
op = _g_arch_instruction_get_operand(instr, 0);
g_arch_operand_print(op, line, 0/*syntax*/);
+ g_object_unref(G_OBJECT(op));
for (i = 1; i < count; i++)
{
@@ -1202,6 +1211,8 @@ static void _g_arch_instruction_print(GArchInstruction *instr, GBufferLine *line
g_arch_operand_print(op, line, 0/*syntax*/);
+ g_object_unref(G_OBJECT(op));
+
}
}