Blame SOURCES/0016-Check-malloc-return.patch

38ab4d
From 739d79c8e87dfaf9695f1f1f92e9ef45a2e706ff Mon Sep 17 00:00:00 2001
5fb29d
From: Peter Jones <pjones@redhat.com>
5fb29d
Date: Wed, 10 Sep 2014 16:49:51 -0400
38ab4d
Subject: [PATCH 16/31] Check malloc() return.
5fb29d
5fb29d
Covscan.
5fb29d
5fb29d
Signed-off-by: Peter Jones <pjones@redhat.com>
5fb29d
---
5fb29d
 src/efibootmgr/efibootmgr.c | 2 ++
5fb29d
 1 file changed, 2 insertions(+)
5fb29d
5fb29d
diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
38ab4d
index d73c6aa..4d80f87 100644
5fb29d
--- a/src/efibootmgr/efibootmgr.c
5fb29d
+++ b/src/efibootmgr/efibootmgr.c
5fb29d
@@ -330,6 +330,8 @@ add_to_boot_order(uint16_t num)
5fb29d
 	old_data = (uint16_t *)boot_order->data;
5fb29d
 	new_data_size = boot_order->data_size + sizeof(uint16_t);
5fb29d
 	new_data = malloc(new_data_size);
5fb29d
+	if (!new_data)
5fb29d
+		return -1;
5fb29d
 
5fb29d
 	new_data[0] = num;
5fb29d
 	memcpy(new_data+1, old_data, boot_order->data_size);
5fb29d
-- 
38ab4d
2.7.4
5fb29d