mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-02-12 18:08:42 +00:00
x86: fix the returned value of cs_disasm_ex() when we have 2 consecutive prefixed instructions. also fix a mem leak bug
This commit is contained in:
parent
a6fc449741
commit
8ce50e4b49
10
cs.c
10
cs.c
@ -376,8 +376,16 @@ size_t cs_disasm_ex(csh ud, const uint8_t *buffer, size_t size, uint64_t offset,
|
||||
break;
|
||||
} else {
|
||||
// only combine 1 prefix with regular instruction
|
||||
if (c == count + 1)
|
||||
if (c == count + 1) {
|
||||
// the last insn is redundant
|
||||
c--;
|
||||
f--;
|
||||
// free allocated detail pointer of the last redundant instruction
|
||||
if (handle->detail)
|
||||
cs_mem_free(insn_cache[f].detail);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user