Blob Blame History Raw
From 4542b2216b6a85d91eb3c5b78e914b2b82f865fa Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 10 Sep 2014 16:49:51 -0400
Subject: [PATCH 15/18] Check malloc() return.

Covscan.

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 src/efibootmgr/efibootmgr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
index f9c25e0..01c1505 100644
--- a/src/efibootmgr/efibootmgr.c
+++ b/src/efibootmgr/efibootmgr.c
@@ -330,6 +330,8 @@ add_to_boot_order(uint16_t num)
 	old_data = (uint16_t *)boot_order->data;
 	new_data_size = boot_order->data_size + sizeof(uint16_t);
 	new_data = malloc(new_data_size);
+	if (!new_data)
+		return -1;
 
 	new_data[0] = num;
 	memcpy(new_data+1, old_data, boot_order->data_size);
-- 
1.9.3