On 10/25/2016 06:07 AM, Markus Armbruster wrote: > Eric Blake <ebl...@redhat.com> writes: > >> Add a test that proves (at least when run under valgrind) that >> we are correctly handling allocated memory even when a visit >> is aborted in the middle for whatever other reason. >> >> See commit f24582d "qapi: fix double free in >> qmp_output_visitor_cleanup()" for a fix that was lacking >> testsuite exposure prior to this patch. >> >> Signed-off-by: Eric Blake <ebl...@redhat.com>
>> +static void test_visitor_out_partial_visit(TestOutputVisitorData *data, >> + const void *unused) >> +{ >> + /* Check that aborting mid-visit doesn't leak or double-free */ >> + visit_start_struct(data->ov, NULL, NULL, 0, &error_abort); >> + visit_start_struct(data->ov, "nested", NULL, 0, &error_abort); >> + visitor_reset(data); > > Add a second test that additionally visits a member? Or is visiting the > "nested" member enough? Visiting "nested" was enough to trigger the particular valgrind trace I wanted, but more coverage never hurts. I'll send v2... > Would you be willing to do the same for lists and alternates? ...and it will also cover these. > > Speaking of alternates, visitor.h's virtual walk example covers struct > and list, but not alternate. Sounds like my v2 will be a longer series :) -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature