check malloc return value
This commit is contained in:
parent
b53a59af53
commit
f1e497502c
6
cs.c
6
cs.c
|
@ -447,6 +447,12 @@ size_t cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, si
|
||||||
|
|
||||||
total_size = sizeof(cs_insn) * cache_size;
|
total_size = sizeof(cs_insn) * cache_size;
|
||||||
total = cs_mem_malloc(total_size);
|
total = cs_mem_malloc(total_size);
|
||||||
|
if (total == NULL)
|
||||||
|
{
|
||||||
|
//malloc failed
|
||||||
|
handle->errnum = CS_ERR_MEM;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
insn_cache = total;
|
insn_cache = total;
|
||||||
|
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
|
|
Loading…
Reference in New Issue