Blob Blame Raw
From 92dc25b822630bc379e52c48c03afddd35ec895d Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Wed, 24 Apr 2013 13:58:31 +0200
Subject: [PATCH 335/364] 	* grub-core/kern/dl.c
 (grub_dl_resolve_symbols): Handle malloc failure.

---
 ChangeLog           | 4 ++++
 grub-core/kern/dl.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 39bb827..598d16c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2013-04-24  Vladimir Serbinenko  <phcoder@gmail.com>
 
+	* grub-core/kern/dl.c (grub_dl_resolve_symbols): Handle malloc failure.
+
+2013-04-24  Vladimir Serbinenko  <phcoder@gmail.com>
+
 	Move mips-arc link address. Previous link address was chosen
 	in belief that RAM on SGI platforms grows down while in fact it
 	grows up from an unusual base.
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index d06b6ae..c6d9ec9 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -359,6 +359,8 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
 
 #ifdef GRUB_MODULES_MACHINE_READONLY
   mod->symtab = grub_malloc (s->sh_size);
+  if (!mod->symtab)
+    return grub_errno;
   memcpy (mod->symtab, (char *) e + s->sh_offset, s->sh_size);
 #else
   mod->symtab = (Elf_Sym *) ((char *) e + s->sh_offset);
-- 
1.8.1.4