* [Qemu-devel] [PATCH for-1.7 0/2] fix qapi mem leaks
@ 2013-11-05 18:35 Wenchao Xia
2013-11-05 18:35 ` [Qemu-devel] [PATCH for-1.7 1/2] qapi: fix memleak by adding implict struct functions in dealloc visitor Wenchao Xia
2013-11-05 18:35 ` [Qemu-devel] [PATCH for-1.7 2/2] tests: fix memleak in error path test for input visitor Wenchao Xia
0 siblings, 2 replies; 3+ messages in thread
From: Wenchao Xia @ 2013-11-05 18:35 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Wenchao Xia, mdroth, qemu-stable
The bugfix patches are picked up from RFC series:
http://lists.nongnu.org/archive/html/qemu-devel/2013-11/msg00363.html
Wenchao Xia (2):
qapi: fix memleak by adding implict struct functions in dealloc visitor
tests: fix memleak in error path test for input visitor
qapi/qapi-dealloc-visitor.c | 20 ++++++++++++++++++++
tests/test-qmp-input-visitor.c | 1 +
2 files changed, 21 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH for-1.7 1/2] qapi: fix memleak by adding implict struct functions in dealloc visitor
2013-11-05 18:35 [Qemu-devel] [PATCH for-1.7 0/2] fix qapi mem leaks Wenchao Xia
@ 2013-11-05 18:35 ` Wenchao Xia
2013-11-05 18:35 ` [Qemu-devel] [PATCH for-1.7 2/2] tests: fix memleak in error path test for input visitor Wenchao Xia
1 sibling, 0 replies; 3+ messages in thread
From: Wenchao Xia @ 2013-11-05 18:35 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Wenchao Xia, mdroth, qemu-stable
Otherwise member "base" is leaked in a qapi_free_STRUCTURE() call.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Cc: qemu-stable@nongnu.org
---
qapi/qapi-dealloc-visitor.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
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.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH for-1.7 2/2] tests: fix memleak in error path test for input visitor
2013-11-05 18:35 [Qemu-devel] [PATCH for-1.7 0/2] fix qapi mem leaks Wenchao Xia
2013-11-05 18:35 ` [Qemu-devel] [PATCH for-1.7 1/2] qapi: fix memleak by adding implict struct functions in dealloc visitor Wenchao Xia
@ 2013-11-05 18:35 ` Wenchao Xia
1 sibling, 0 replies; 3+ messages in thread
From: Wenchao Xia @ 2013-11-05 18:35 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Wenchao Xia, mdroth, qemu-stable
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Cc: qemu-stable@nongnu.org
---
tests/test-qmp-input-visitor.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c
index 0beb8fb..1e1c6fa 100644
--- a/tests/test-qmp-input-visitor.c
+++ b/tests/test-qmp-input-visitor.c
@@ -604,6 +604,7 @@ static void test_visitor_in_errors(TestInputVisitorData *data,
g_assert(error_is_set(&errp));
g_assert(p->string == NULL);
+ error_free(errp);
g_free(p->string);
g_free(p);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-06 2:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-05 18:35 [Qemu-devel] [PATCH for-1.7 0/2] fix qapi mem leaks Wenchao Xia
2013-11-05 18:35 ` [Qemu-devel] [PATCH for-1.7 1/2] qapi: fix memleak by adding implict struct functions in dealloc visitor Wenchao Xia
2013-11-05 18:35 ` [Qemu-devel] [PATCH for-1.7 2/2] tests: fix memleak in error path test for input visitor Wenchao Xia
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).