[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/5] loader: g_realloc(p, 0) frees and returns NULL,
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 1/5] loader: g_realloc(p, 0) frees and returns NULL, simplify |
Date: |
Tue, 30 Sep 2014 12:40:01 +0300 |
From: Markus Armbruster <address@hidden>
Once upon a time, it was decided that qemu_realloc(ptr, 0) should
abort. Switching to glib retired that bright idea. A bit of code
that was added to cope with it (commit 3e372cf) is still around. Bury
it.
See also commit 6528499.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/elf_ops.h | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index c6b5129..a517753 100644
--- a/include/hw/elf_ops.h
+++ b/include/hw/elf_ops.h
@@ -147,18 +147,13 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr,
int fd, int must_swab,
}
i++;
}
- if (nsyms) {
- syms = g_realloc(syms, nsyms * sizeof(*syms));
+ syms = g_realloc(syms, nsyms * sizeof(*syms));
- qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ));
- for (i = 0; i < nsyms - 1; i++) {
- if (syms[i].st_size == 0) {
- syms[i].st_size = syms[i + 1].st_value - syms[i].st_value;
- }
+ qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ));
+ for (i = 0; i < nsyms - 1; i++) {
+ if (syms[i].st_size == 0) {
+ syms[i].st_size = syms[i + 1].st_value - syms[i].st_value;
}
- } else {
- g_free(syms);
- syms = NULL;
}
/* String table */
--
MST
- [Qemu-devel] [PULL 0/5] pci, pc, virtio, misc bugfixes, Michael S. Tsirkin, 2014/09/30
- [Qemu-devel] [PULL 1/5] loader: g_realloc(p, 0) frees and returns NULL, simplify,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 2/5] Revert "virtio-pci: fix migration for pci bus master", Michael S. Tsirkin, 2014/09/30
- [Qemu-devel] [PULL 3/5] pci-hotplug-old: avoid losing error message, Michael S. Tsirkin, 2014/09/30
- [Qemu-devel] [PULL 5/5] vl: Adjust the place of calling mlockall to speedup VM's startup, Michael S. Tsirkin, 2014/09/30
- [Qemu-devel] [PULL 4/5] pc-dimm: Don't check dimm->node when there is non-NUMA config, Michael S. Tsirkin, 2014/09/30
- Re: [Qemu-devel] [PULL 0/5] pci, pc, virtio, misc bugfixes, Peter Maydell, 2014/09/30