From 3a0541e5fa65070a21f9a62772cb1fc11ea77c2a Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 21 Sep 2021 19:17:58 +0200 Subject: [PATCH] Check malloc error --- emu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/emu.c b/emu.c index f358214..999edc4 100644 --- a/emu.c +++ b/emu.c @@ -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);