* [Qemu-devel] [PATCH] linux-user: Protect against allocation failure in load_symbols.
@ 2010-07-29 16:37 Richard Henderson
2010-07-29 16:55 ` [Qemu-devel] " malc
0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2010-07-29 16:37 UTC (permalink / raw)
To: qemu-devel; +Cc: edgar.iglesias
Cc: malc <av1474@comtv.ru>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/elfload.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index a53285a..33d776d 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1546,7 +1546,17 @@ static void load_symbols(struct elfhdr *hdr, int fd, abi_ulong load_bias)
}
}
+ /* Attempt to free the storage associated with the local symbols
+ that we threw away. Whether or not this has any effect on the
+ memory allocation depends on the malloc implementation and how
+ many symbols we managed to discard. */
syms = realloc(syms, nsyms * sizeof(*syms));
+ if (syms == NULL) {
+ free(s);
+ free(strings);
+ return;
+ }
+
qsort(syms, nsyms, sizeof(*syms), symcmp);
s->disas_num_syms = nsyms;
--
1.7.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-29 16:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29 16:37 [Qemu-devel] [PATCH] linux-user: Protect against allocation failure in load_symbols Richard Henderson
2010-07-29 16:55 ` [Qemu-devel] " malc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).