mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 17:47:15 +03: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>
|
||||
|
||||
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.
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user