diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2017-11-26 20:39:28 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2017-11-26 20:39:28 (GMT) | 
| commit | 1252efcd18a845a7c2641354838c26ece3d6d873 (patch) | |
| tree | 13d248454e99b76dd4c61fbd41c8c138ebb61eb7 /src/arch/instruction.c | |
| parent | 84efc00d07f9574c3867f96a3a7333b0f9d154e6 (diff) | |
Increased the reference counter for provided operands and updated code.
Diffstat (limited to 'src/arch/instruction.c')
| -rw-r--r-- | src/arch/instruction.c | 13 | 
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)); +          }      }  | 
