[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-2.7 v4 17/36] machine: use class base init gener
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH for-2.7 v4 17/36] machine: use class base init generated name |
Date: |
Fri, 5 Aug 2016 12:24:02 +0400 |
From: Marc-André Lureau <address@hidden>
machine_class_base_init() member name is allocated by
machine_class_base_init(), but not freed by
machine_class_finalize(). Simply freeing there doesn't work,
because DEFINE_PC_MACHINE() overwrites it with a literal string.
Fix DEFINE_PC_MACHINE() not to overwrite it, and add the missing
free to machine_class_finalize().
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
---
hw/core/machine.c | 1 +
include/hw/boards.h | 2 +-
include/hw/i386/pc.h | 1 -
3 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index e5a456f..00fbe3e 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -561,6 +561,7 @@ static void machine_class_finalize(ObjectClass *klass, void
*data)
if (mc->compat_props) {
g_array_free(mc->compat_props, true);
}
+ g_free(mc->name);
}
void machine_register_compat_props(MachineState *machine)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 3e69eca..e46a744 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -93,7 +93,7 @@ struct MachineClass {
/*< public >*/
const char *family; /* NULL iff @name identifies a standalone machtype */
- const char *name;
+ char *name;
const char *alias;
const char *desc;
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 330c1f2..422fac7 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -903,7 +903,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
{ \
MachineClass *mc = MACHINE_CLASS(oc); \
optsfn(mc); \
- mc->name = namestr; \
mc->init = initfn; \
} \
static const TypeInfo pc_machine_type_##suffix = { \
--
2.9.0
- [Qemu-devel] [PATCH for-2.7 v4 07/36] tests: fix test-vmstate leaks, (continued)
- [Qemu-devel] [PATCH for-2.7 v4 07/36] tests: fix test-vmstate leaks, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 08/36] tests: fix test-iov leaks, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 09/36] tests: fix check-qom-interface leaks, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 10/36] tests: fix check-qom-proplist leaks, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 11/36] tests: fix small leak in test-io-channel-command, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 12/36] tests: fix leak in test-string-input-visitor, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 13/36] portio: keep references on portio, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 14/36] numa: do not leak NumaOptions, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 15/36] pc: simplify passing qemu_irq, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 16/36] pc: don't leak a20_line, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 17/36] machine: use class base init generated name,
marcandre . lureau <=
- [Qemu-devel] [PATCH for-2.7 v4 18/36] acpi-build: fix array leak, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 19/36] char: free the tcp connection data when closing, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 20/36] char: free MuxDriver when closing, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 21/36] tests: fix qom-test leaks, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 22/36] pc: free i8259, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 23/36] pc: keep gsi reference, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 24/36] ahci: free irqs array, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 25/36] sd: free timer, marcandre . lureau, 2016/08/05
- [Qemu-devel] [PATCH for-2.7 v4 26/36] qjson: free str, marcandre . lureau, 2016/08/05