Skip to content

Commit

Permalink
Merge pull request #531 from RinHizakura/master
Browse files Browse the repository at this point in the history
Avoid to wrongly allocate memory in map_file()
  • Loading branch information
jserv authored Dec 30, 2024
2 parents 060b0fb + f554a00 commit e89e613
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e89e613

Please sign in to comment.