From 0ca9dee2cb8f8e4b7b2602f51f0be34f0304028a Mon Sep 17 00:00:00 2001 From: Yiwei Lin Date: Sat, 28 Dec 2024 15:41:32 +0800 Subject: [PATCH] Fix crash on system without mmap() --- src/riscv.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/riscv.c b/src/riscv.c index a06a2f33..1dc05b0c 100644 --- a/src/riscv.c +++ b/src/riscv.c @@ -239,10 +239,6 @@ static void map_file(char **ram_loc, const char *name) if (*ram_loc == MAP_FAILED) goto cleanup; #else - /* calloc and load data to a memory region */ - *ram_loc = calloc(st.st_size, sizeof(uint8_t)); - if (!*ram_loc) - goto cleanup; if (read(fd, *ram_loc, st.st_size) != st.st_size) { free(*ram_loc); goto cleanup;