Check malloc error

This commit is contained in:
Rodrigo Arias 2021-09-21 19:17:58 +02:00
parent 8b78baa587
commit 3a0541e5fa

10
emu.c
View File

@ -603,7 +603,15 @@ emu_destroy(struct ovni_emu *emu)
int
main(int argc, char *argv[])
{
struct ovni_emu *emu = (struct ovni_emu *) malloc(sizeof(struct ovni_emu));
struct ovni_emu *emu;
emu = malloc(sizeof(struct ovni_emu));
if(emu == NULL)
{
perror("malloc");
return 1;
}
emu_init(emu, argc, argv);