[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] loader: don't call realloc(O) when no symbols are p
From: |
Aurelien Jarno |
Subject: |
[Qemu-devel] [PATCH] loader: don't call realloc(O) when no symbols are present |
Date: |
Mon, 28 Dec 2009 14:49:49 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
This fixes the loading of a stripped kernel with zero malloc disabled.
Signed-off-by: Aurelien Jarno <address@hidden>
---
hw/elf_ops.h | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/hw/elf_ops.h b/hw/elf_ops.h
index 6093dea..d0811ca 100644
--- a/hw/elf_ops.h
+++ b/hw/elf_ops.h
@@ -149,9 +149,14 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int
fd, int must_swab,
}
i++;
}
- syms = qemu_realloc(syms, nsyms * sizeof(*syms));
+ if (nsyms) {
+ syms = qemu_realloc(syms, nsyms * sizeof(*syms));
- qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ));
+ qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ));
+ } else {
+ free(syms);
+ syms = NULL;
+ }
/* String table */
if (symtab->sh_link >= ehdr->e_shnum)
--
1.6.5.3
- [Qemu-devel] [PATCH] loader: don't call realloc(O) when no symbols are present,
Aurelien Jarno <=