瀏覽代碼

efi_loader: efi_gop: check calloc return value

Calloc may return NULL. We have to check the return value.

Fixes: be8d324191f efi_loader: Add GOP support
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Heinrich Schuchardt 7 年之前
父節點
當前提交
753edb131a
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      lib/efi_loader/efi_gop.c

+ 4 - 0
lib/efi_loader/efi_gop.c

@@ -173,6 +173,10 @@ int efi_gop_register(void)
 	}
 
 	gopobj = calloc(1, sizeof(*gopobj));
+	if (!gopobj) {
+		printf("ERROR: Out of memory\n");
+		return 1;
+	}
 
 	/* Fill in object data */
 	gopobj->parent.protocols[0].guid = &efi_gop_guid;