blob: d85161cd25b28f54117cb2e5bf3f5ba9f25bfa3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
From d944fafe8cee766e5c3c601a16797b890420802c Mon Sep 17 00:00:00 2001
From: Gabriel Kihlman <g.kihlman@yubico.com>
Date: Wed, 18 Dec 2019 12:34:30 +0100
Subject: [PATCH 16/25] Handle the case when new_device() returns NULL (malloc
failure)
Signed-off-by: Gustavo B. Schenkel <gustavo.schenkel@gmail.com>
---
u2f-host/devs.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/u2f-host/devs.c b/u2f-host/devs.c
index aa76c9f..7650743 100644
--- a/u2f-host/devs.c
+++ b/u2f-host/devs.c
@@ -435,6 +435,11 @@ u2fh_devs_discover (u2fh_devs * devs, unsigned *max_index)
if (usage_page == FIDO_USAGE_PAGE && usage == FIDO_USAGE_U2FHID)
{
dev = new_device (devs);
+ if (dev == NULL)
+ {
+ res = U2FH_MEMORY_ERROR;
+ goto out;
+ }
dev->devh = hid_open_path (cur_dev->path);
if (dev->devh != NULL)
{
--
2.32.0
|