From: Michel Pollet Date: Sun, 11 Apr 2010 18:38:24 +0000 (+0100) Subject: ELF: Fixes a bad malloc X-Git-Tag: v1.0a2~3 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=d2196da73575ab6fafce44ddbe817ae20b61e8c0;p=sx%2Fsimavr.git ELF: Fixes a bad malloc How it didn't crash before, no idea... Signed-off-by: Michel Pollet --- diff --git a/simavr/sim/sim_elf.c b/simavr/sim/sim_elf.c index 92b9724..c6dbca6 100644 --- a/simavr/sim/sim_elf.c +++ b/simavr/sim/sim_elf.c @@ -228,7 +228,7 @@ int elf_read_firmware(const char * file, elf_firmware_t * firmware) } else { // code if (firmware->codeline[sym.st_value >> 1] == NULL) { - avr_symbol_t * s = firmware->codeline[sym.st_value >> 1] = malloc(sizeof(avr_symbol_t*)); + avr_symbol_t * s = firmware->codeline[sym.st_value >> 1] = malloc(sizeof(avr_symbol_t)); s->symbol = strdup(name); s->addr = sym.st_value; }