commit | f1e497502c6851a76b57388fcfbdcec5120c6f8b | [log] [tgz] |
---|---|---|
author | Edward Williamson <[email protected]> | Sun Dec 14 20:45:19 2014 -0500 |
committer | Edward Williamson <[email protected]> | Sun Dec 14 20:45:19 2014 -0500 |
tree | 18ceba7063ae56655574e73b775d0f1421eee975 | |
parent | b53a59af53ffbd5dbe8dbcefba41a00cf4fc7469 [diff] [blame] |
check malloc return value
diff --git a/cs.c b/cs.c index 04bc615..1d1634d 100644 --- a/cs.c +++ b/cs.c
@@ -447,6 +447,12 @@ total_size = sizeof(cs_insn) * cache_size; total = cs_mem_malloc(total_size); + if (total == NULL) + { + //malloc failed + handle->errnum = CS_ERR_MEM; + return 0; + } insn_cache = total; while (size > 0) {