Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regressions in custom memory allocator support #1934

Merged
merged 1 commit into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions arch/AArch64/AArch64Disassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ static DecodeStatus _getInstruction(cs_struct *ud, MCInst *MI,

// Init new MCOperand to be used in switch below.
// Kind RegVal set inside a case when needed.
MCOperand *Op;
Op = malloc(sizeof(MCOperand));
MCOperand op_storage;
MCOperand *Op = &op_storage;
switch (MCInst_getOpcode(MI)) {
default:
break;
Expand Down Expand Up @@ -342,7 +342,6 @@ static DecodeStatus _getInstruction(cs_struct *ud, MCInst *MI,
MCInst_addOperand2(MI, Op);
break;
}
free(Op);

if (result != MCDisassembler_Fail) {
*Size = 4;
Expand Down
4 changes: 2 additions & 2 deletions arch/AArch64/AArch64InstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2485,7 +2485,7 @@ static void printMatrixTileVector(MCInst *MI, unsigned OpNum, SStream *O, bool I

const size_t strLn = strlen(RegName);
// +2 for extra chars, + 1 for null char \0
char *RegNameNew = malloc(sizeof(char) * (strLn + 2 + 1));
char *RegNameNew = cs_mem_malloc(sizeof(char) * (strLn + 2 + 1));
int index = 0, i;
for (i = 0; i < (strLn + 2); i++){
if(RegName[i] != '.'){
Expand Down Expand Up @@ -2513,7 +2513,7 @@ static void printMatrixTileVector(MCInst *MI, unsigned OpNum, SStream *O, bool I
MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Reg;
MI->flat_insn->detail->arm64.op_count++;
}
free(RegNameNew);
cs_mem_free(RegNameNew);
}

static const unsigned MatrixZADRegisterTable[] = {
Expand Down