
On Thu, May 22, 2008 at 08:57:04AM -0400, Daniel Veillard wrote:
On Thu, May 22, 2008 at 12:49:04AM +0100, Daniel P. Berrange wrote:
I found a couple more small bugs in the qparams code
- In the qparam_query_parse() method, after appending each (name,value) pair of params, it failed to free the temporary buffers for the (name,value) pair. - Did not allow for ';' as a valid query parameter separator - In a couple of OOM cleanup scenarios it failed to free buffers allocated earlier on
In looking at this I decide we ought to have a test suite for this code so I'm also including one. It has 100% coverage of all the non-OOM code paths. The test case now passes when run under valgrind
Great, +1 How do you assert coverage ? gcov ? I think I used one of the KDE valgrind skins in the past to check those graphically but it was a long time ago and not for libvirt.
I run the test script once, count all the allocations, and then it again once for each allocation and fail a different one each time & verify that the test then failed, but didn't SEGV/abort. For extra run I then run this under valgrind to verify the error handling paths don't also leak memory. I'll post it shortly... Dan. -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|