mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-13 11:15:08 +00:00
Avoid used-uninitialized errors in test driver.
* src/test.c (testOpenFromFile): Initialize "privconn".
This commit is contained in:
parent
6997b1920f
commit
1217e5d516
@ -1,5 +1,8 @@
|
|||||||
Wed Jan 30 20:49:34 CET 2008 Jim Meyering <meyering@redhat.com>
|
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.
|
* src/libvirt.c (do_open): Avoid double-free upon failure.
|
||||||
|
|
||||||
Avoid segfault upon malloc failure, and plug a leak.
|
Avoid segfault upon malloc failure, and plug a leak.
|
||||||
|
@ -672,7 +672,7 @@ static int testOpenFromFile(virConnectPtr conn,
|
|||||||
xmlNodePtr *domains, *networks = NULL;
|
xmlNodePtr *domains, *networks = NULL;
|
||||||
xmlXPathContextPtr ctxt = NULL;
|
xmlXPathContextPtr ctxt = NULL;
|
||||||
virNodeInfoPtr nodeInfo;
|
virNodeInfoPtr nodeInfo;
|
||||||
testConnPtr privconn = malloc(sizeof(*privconn));
|
testConnPtr privconn = calloc(1, sizeof(*privconn));
|
||||||
if (!privconn) {
|
if (!privconn) {
|
||||||
testError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "testConn");
|
testError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "testConn");
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
|
Loading…
Reference in New Issue
Block a user