[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC][PATCH v2 06/17] qapi: fix memory leak for async marsh
From: |
Michael Roth |
Subject: |
[Qemu-devel] [RFC][PATCH v2 06/17] qapi: fix memory leak for async marshalling code |
Date: |
Mon, 18 Apr 2011 10:02:22 -0500 |
When generating the callback function for an async command, if we expect
a QString we copy it into a native char* type, then call the completion
function. We should free it after calling the completion function, since
the completion function will later copy it into a new QString before
adding it to the response object and then passing it on to the wire.
Signed-off-by: Michael Roth <address@hidden>
---
qmp-gen.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/qmp-gen.py b/qmp-gen.py
index 4164692..3667ec5 100644
--- a/qmp-gen.py
+++ b/qmp-gen.py
@@ -349,6 +349,10 @@ static void qmp_%(c_name)s_cb(void *qmp__opaque, QObject
*qmp__retval, Error *qm
ret += cgen(' qmp__cb->cb(qmp__cb->opaque, qmp__err);')
else:
ret += cgen(' qmp__cb->cb(qmp__cb->opaque, qmp__native_retval,
qmp__err);')
+ if retval != 'none' and qmp_type_should_free(retval):
+ ret += cgen(' %(free)s(qmp__native_retval);',
+ free=qapi_free_func(retval))
+
ret += cgen('}')
return ret
--
1.7.0.4
- [Qemu-devel] [RFC][PATCH v2 00/11] QEMU Guest Agent: QMP-based host/guest communication (virtagent), Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 04/17] qapi: fix function name typo in qmp-gen.py, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 09/17] qmp proxy: core code for proxying qmp requests to guest, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 10/17] qmp proxy: add qmp_proxy chardev, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 06/17] qapi: fix memory leak for async marshalling code,
Michael Roth <=
- [Qemu-devel] [RFC][PATCH v2 07/17] qapi: qmp-gen.py, use basename of path for guard/core prefix, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 02/17] json-streamer: add handling for JSON_ERROR token/state, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 01/17] json-lexer: make lexer error-recovery more deterministic, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 05/17] qapi: fix handling for null-return async callbacks, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 03/17] json-parser: add handling for NULL token list, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 08/17] qapi: fix Error usage in qemu-sockets.c, Michael Roth, 2011/04/18
- [Qemu-devel] [RFC][PATCH v2 12/17] guest agent: worker thread class, Michael Roth, 2011/04/18