mirror of
https://gitlab.com/qemu-project/capstone.git
synced 2025-09-17 02:01:15 +08:00
add new option CS_OPT_MEM for cs_option(): this enable user-defined dynamic memory management. idea proposed by Pancake
This commit is contained in:
10
MCInst.c
10
MCInst.c
@ -30,7 +30,7 @@ void MCInst_insert(MCInst *inst, int index, MCOperand *Op)
|
||||
inst->Operands[index] = *Op;
|
||||
inst->size++;
|
||||
|
||||
free(Op);
|
||||
my_free(Op);
|
||||
}
|
||||
|
||||
void MCInst_setOpcode(MCInst *inst, unsigned Op)
|
||||
@ -71,7 +71,7 @@ int MCInst_addOperand(MCInst *inst, MCOperand *Op)
|
||||
return -1;
|
||||
|
||||
inst->Operands[inst->size] = *Op;
|
||||
free(Op);
|
||||
my_free(Op);
|
||||
|
||||
inst->size++;
|
||||
|
||||
@ -152,7 +152,7 @@ void MCOperand_setFPImm(MCOperand *op, double Val)
|
||||
|
||||
MCOperand *MCOperand_CreateReg(unsigned Reg)
|
||||
{
|
||||
MCOperand *op = malloc(sizeof(*op));
|
||||
MCOperand *op = my_malloc(sizeof(*op));
|
||||
|
||||
op->Kind = kRegister;
|
||||
op->RegVal = Reg;
|
||||
@ -162,7 +162,7 @@ MCOperand *MCOperand_CreateReg(unsigned Reg)
|
||||
|
||||
MCOperand *MCOperand_CreateImm(int64_t Val)
|
||||
{
|
||||
MCOperand *op = malloc(sizeof(*op));
|
||||
MCOperand *op = my_malloc(sizeof(*op));
|
||||
|
||||
op->Kind = kImmediate;
|
||||
op->ImmVal = Val;
|
||||
@ -172,7 +172,7 @@ MCOperand *MCOperand_CreateImm(int64_t Val)
|
||||
|
||||
MCOperand *MCOperand_CreateFPImm(double Val)
|
||||
{
|
||||
MCOperand *op = malloc(sizeof(*op));
|
||||
MCOperand *op = my_malloc(sizeof(*op));
|
||||
|
||||
op->Kind = kFPImmediate;
|
||||
op->FPImmVal = Val;
|
||||
|
Reference in New Issue
Block a user