On 10/18/2016 06:13 AM, Eric Blake wrote: > On 10/18/2016 04:17 AM, Pino Toscano wrote: >> qmp_output_start_struct() and qmp_output_start_list() create a new >> QObject (QDict, QList) and push it to the stack of the QmpOutputVisitor, >> where it is saved as 'value'. When freeing the iterator in >> qmp_output_free(), these values are never freed properly. > > Do any of the tests (perhaps run under valgrind) show this leak? If not, > maybe we should enhance their coverage. > >> >> The simple solution is to qobject_decref() them. >> --- >> qapi/qmp-output-visitor.c | 1 + >> 1 file changed, 1 insertion(+) > > Reviewed-by: Eric Blake <ebl...@redhat.com>
except this should be done against v2, where you had S-o-B :) > >> >> diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c >> index 9e3b67c..eedf256 100644 >> --- a/qapi/qmp-output-visitor.c >> +++ b/qapi/qmp-output-visitor.c >> @@ -220,6 +220,7 @@ static void qmp_output_free(Visitor *v) >> while (!QSLIST_EMPTY(&qov->stack)) { >> e = QSLIST_FIRST(&qov->stack); >> QSLIST_REMOVE_HEAD(&qov->stack, node); >> + qobject_decref(e->value); >> g_free(e); >> } >> >> > -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature