[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 17/32] qapi: fix memleak by adding implict struct fu
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 17/32] qapi: fix memleak by adding implict struct functions in dealloc visitor |
Date: |
Wed, 4 Dec 2013 08:34:24 -0600 |
From: Wenchao Xia <address@hidden>
Otherwise member "base" is leaked in a qapi_free_STRUCTURE() call.
Signed-off-by: Wenchao Xia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Cc: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>
(cherry picked from commit 3dce9cad5a6c0b0dbe0830973b270c9466c8ab4b)
Signed-off-by: Michael Roth <address@hidden>
---
qapi/qapi-dealloc-visitor.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c
index 1334de3..dc53545 100644
--- a/qapi/qapi-dealloc-visitor.c
+++ b/qapi/qapi-dealloc-visitor.c
@@ -76,6 +76,24 @@ static void qapi_dealloc_end_struct(Visitor *v, Error **errp)
}
}
+static void qapi_dealloc_start_implicit_struct(Visitor *v,
+ void **obj,
+ size_t size,
+ Error **errp)
+{
+ QapiDeallocVisitor *qov = to_qov(v);
+ qapi_dealloc_push(qov, obj);
+}
+
+static void qapi_dealloc_end_implicit_struct(Visitor *v, Error **errp)
+{
+ QapiDeallocVisitor *qov = to_qov(v);
+ void **obj = qapi_dealloc_pop(qov);
+ if (obj) {
+ g_free(*obj);
+ }
+}
+
static void qapi_dealloc_start_list(Visitor *v, const char *name, Error **errp)
{
QapiDeallocVisitor *qov = to_qov(v);
@@ -162,6 +180,8 @@ QapiDeallocVisitor *qapi_dealloc_visitor_new(void)
v->visitor.start_struct = qapi_dealloc_start_struct;
v->visitor.end_struct = qapi_dealloc_end_struct;
+ v->visitor.start_implicit_struct = qapi_dealloc_start_implicit_struct;
+ v->visitor.end_implicit_struct = qapi_dealloc_end_implicit_struct;
v->visitor.start_list = qapi_dealloc_start_list;
v->visitor.next_list = qapi_dealloc_next_list;
v->visitor.end_list = qapi_dealloc_end_list;
--
1.7.9.5
- [Qemu-devel] [PATCH 26/32] vfio-pci: Fix multifunction=on, (continued)
- [Qemu-devel] [PATCH 26/32] vfio-pci: Fix multifunction=on, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 28/32] qom: Fix memory leak in object_property_set_link(), Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 13/32] monitor: eliminate monitor_event_state_lock, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 27/32] virtio-net: fix the memory leak in rxfilter_notify(), Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 21/32] virtio-net: only delete bh that existed, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 24/32] qcow2: count_contiguous_clusters and compression, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 25/32] qcow2: fix possible corruption when reading multiple clusters, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 20/32] linux-user: Fix stat64 syscall for SPARC64, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 14/32] memory: fix 128 arithmetic in info mtree, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 19/32] configure: Explicitly set ARFLAGS so we can build with GNU Make 4.0, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 17/32] qapi: fix memleak by adding implict struct functions in dealloc visitor,
Michael Roth <=
- [Qemu-devel] [PATCH 11/32] vmdk: Fix vmdk_parse_extents, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 15/32] Adjust qapi-visit for python-2.4.3, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 18/32] tests: fix memleak in error path test for input visitor, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 23/32] Fix pc migration from qemu <= 1.5, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 16/32] configure: detect endian via compile test, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 22/32] exec: fix breakpoint_invalidate when pc may not be translated, Michael Roth, 2013/12/04
- Re: [Qemu-devel] Patch Round-up for stable 1.6.2, freeze on 2013-12-06, Paolo Bonzini, 2013/12/05