[libvirt] Double free in test driver error handling (0.4.4)

While debugging the libvirt-java error handling problem, Ive found that if I call the test driver with a bad uri, the application instantly bombs with a double free error. Try to run the attached test program to trigger the bug. regards István #include <libvirt/libvirt.h> #include <stdio.h> int main(){ int ret=virInitialize(); virConnectOpen("test:///defaultt"); }

On Mon, Jul 21, 2008 at 07:03:29PM +0200, T?th Istv?n wrote:
While debugging the libvirt-java error handling problem, Ive found that if I call the test driver with a bad uri, the application instantly bombs with a double free error.
Try out this patch: diff -r 59140de4e7a9 src/test.c --- a/src/test.c Mon Jul 21 18:27:29 2008 +0100 +++ b/src/test.c Tue Jul 22 22:12:22 2008 +0100 @@ -314,7 +314,7 @@ char *str; xmlDocPtr xml = NULL; xmlNodePtr root = NULL; - xmlNodePtr *domains, *networks = NULL; + xmlNodePtr *domains = NULL, *networks = NULL; xmlXPathContextPtr ctxt = NULL; virNodeInfoPtr nodeInfo; virNetworkObjPtr net; Daniel -- |: Red Hat, Engineering, London -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 :|

On Thu, Jul 24, 2008 at 09:41:10AM +0100, Daniel P. Berrange wrote:
On Mon, Jul 21, 2008 at 07:03:29PM +0200, T?th Istv?n wrote:
While debugging the libvirt-java error handling problem, Ive found that if I call the test driver with a bad uri, the application instantly bombs with a double free error.
Try out this patch:
diff -r 59140de4e7a9 src/test.c --- a/src/test.c Mon Jul 21 18:27:29 2008 +0100 +++ b/src/test.c Tue Jul 22 22:12:22 2008 +0100 @@ -314,7 +314,7 @@ char *str; xmlDocPtr xml = NULL; xmlNodePtr root = NULL; - xmlNodePtr *domains, *networks = NULL; + xmlNodePtr *domains = NULL, *networks = NULL; xmlXPathContextPtr ctxt = NULL; virNodeInfoPtr nodeInfo; virNetworkObjPtr net;
I think Tóth is in vacations, looks fine, just push it ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Tóth István