cherry-pick bug fix

This commit is contained in:
Alwin Berger 2023-07-28 09:33:46 +02:00
parent 8e3d880484
commit be821a3cd7

4
cpu.c
View File

@ -200,7 +200,7 @@ int libafl_qemu_set_breakpoint(target_ulong pc)
libafl_breakpoint_invalidate(cpu, pc); libafl_breakpoint_invalidate(cpu, pc);
} }
struct libafl_breakpoint* bp = malloc(sizeof(struct libafl_breakpoint)); struct libafl_breakpoint* bp = calloc(sizeof(struct libafl_breakpoint), 1);
bp->addr = pc; bp->addr = pc;
bp->next = libafl_qemu_breakpoints; bp->next = libafl_qemu_breakpoints;
libafl_qemu_breakpoints = bp; libafl_qemu_breakpoints = bp;
@ -257,7 +257,7 @@ size_t libafl_qemu_set_hook(target_ulong pc, void (*callback)(target_ulong, uint
size_t idx = LIBAFL_TABLES_HASH(pc); size_t idx = LIBAFL_TABLES_HASH(pc);
struct libafl_hook* hk = malloc(sizeof(struct libafl_hook)); struct libafl_hook* hk = calloc(sizeof(struct libafl_hook), 1);
hk->addr = pc; hk->addr = pc;
hk->callback = callback; hk->callback = callback;
hk->data = data; hk->data = data;