]> xenbits.xensource.com Git - libvirt.git/commitdiff
Avoid used-uninitialized errors in test driver.
authorJim Meyering <meyering@redhat.com>
Wed, 30 Jan 2008 19:54:29 +0000 (19:54 +0000)
committerJim Meyering <meyering@redhat.com>
Wed, 30 Jan 2008 19:54:29 +0000 (19:54 +0000)
* src/test.c (testOpenFromFile): Initialize "privconn".

ChangeLog
src/test.c

index 41629f032dd29b6e4f9dbe8967572fcb789805ca..f91591533d3e9fb56285650adc8194ceed26e686 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 Wed Jan 30 20:49:34 CET 2008  Jim Meyering  <meyering@redhat.com>
 
+       Avoid used-uninitialized errors in test driver.
+       * src/test.c (testOpenFromFile): Initialize "privconn".
+
        * src/libvirt.c (do_open): Avoid double-free upon failure.
 
        Avoid segfault upon malloc failure, and plug a leak.
index 85170d9961319cfdfa7245904a5b108d7a77f650..fe5da41f11518b252723512bce648cf4b4207bdc 100644 (file)
@@ -672,7 +672,7 @@ static int testOpenFromFile(virConnectPtr conn,
     xmlNodePtr *domains, *networks = NULL;
     xmlXPathContextPtr ctxt = NULL;
     virNodeInfoPtr nodeInfo;
-    testConnPtr privconn = malloc(sizeof(*privconn));
+    testConnPtr privconn = calloc(1, sizeof(*privconn));
     if (!privconn) {
         testError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "testConn");
         return VIR_DRV_OPEN_ERROR;