arm: fix a memory leaking bug
diff --git a/MCInst.c b/MCInst.c
index e63e55c..f911257 100644
--- a/MCInst.c
+++ b/MCInst.c
@@ -18,6 +18,7 @@
inst->size = 0;
}
+// NOTE: this will free @Op argument
void MCInst_insert(MCInst *inst, int index, MCOperand *Op)
{
int i;
@@ -28,6 +29,8 @@
inst->Operands[index] = *Op;
inst->size++;
+
+ free(Op);
}
void MCInst_setOpcode(MCInst *inst, unsigned Op)
@@ -60,6 +63,7 @@
return inst->size;
}
+// NOTE: this will free @Op argument
int MCInst_addOperand(MCInst *inst, MCOperand *Op)
{
if (inst->size == ARR_SIZE(inst->Operands))