Skip to content

Commit cbab5b8

Browse files
authored
Validate malloc return value (#346)
checking if it is NULL. Co-authored-by: Chun-Hung Tseng <[email protected]>
1 parent d3987da commit cbab5b8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/jit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,7 @@ uint32_t jit_translate(riscv_t *rv, block_t *block)
14811481
struct jit_state *jit_state_init(size_t size)
14821482
{
14831483
struct jit_state *state = malloc(sizeof(struct jit_state));
1484+
assert(state);
14841485
state->offset = 0;
14851486
state->size = size;
14861487
state->buf = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC,

0 commit comments

Comments
 (0)