summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2017-10-26 19:25:47 +0200
committerAlexander Graf <agraf@suse.de>2017-12-01 13:22:56 +0100
commitcb90ee97579daeacc3173d4c9694b53136a55981 (patch)
treef048d58c1cac9c26d824631c94d50c94de64bf63
parent93945f2c65ff80290fc2af4f5c5d9bb52ff9ffa5 (diff)
efi_loader: efi_net: check return value of calloc
Calloc may return NULL. So we must check the return value. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--lib/efi_loader/efi_net.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index 432d9a99a2..a7b101e830 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -292,6 +292,10 @@ int efi_net_register(void)
/* We only expose the "active" eth device, so one is enough */
netobj = calloc(1, sizeof(*netobj));
+ if (!netobj) {
+ printf("ERROR: Out of memory\n");
+ return 1;
+ }
/* Fill in object data */
netobj->parent.protocols[0].guid = &efi_net_guid;