mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-13 11:15:08 +00:00
test:///default driver: don't dereference NULL "def"
* src/test.c (testNetworkCreate, testNetworkDefine): Since "def" is set to NULL immediately after any vir*AssignDef call (to indicate we no longer own it and to ensure no clean-up path mistakenly frees it), dereference via net->def->, not def->.
This commit is contained in:
parent
6efe591e66
commit
f98b9e05d8
@ -1,3 +1,11 @@
|
|||||||
|
Fri Feb 13 19:09:54 +0100 2009 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
|
test:///default driver: don't dereference NULL "def"
|
||||||
|
* src/test.c (testNetworkCreate, testNetworkDefine): Since "def" is
|
||||||
|
set to NULL immediately after any vir*AssignDef call (to indicate we
|
||||||
|
no longer own it and to ensure no clean-up path mistakenly frees it),
|
||||||
|
dereference via net->def->, not def->.
|
||||||
|
|
||||||
Fri Feb 13 12:31:03 CET 2009 Guido Günther <agx@sigxcpu.org>
|
Fri Feb 13 12:31:03 CET 2009 Guido Günther <agx@sigxcpu.org>
|
||||||
|
|
||||||
usleep to wait for domain logfile to fill up
|
usleep to wait for domain logfile to fill up
|
||||||
|
22
src/test.c
22
src/test.c
@ -2049,14 +2049,12 @@ static virNetworkPtr testNetworkCreate(virConnectPtr conn, const char *xml) {
|
|||||||
if ((def = virNetworkDefParseString(conn, xml)) == NULL)
|
if ((def = virNetworkDefParseString(conn, xml)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((net = virNetworkAssignDef(conn, &privconn->networks,
|
if ((net = virNetworkAssignDef(conn, &privconn->networks, def)) == NULL)
|
||||||
def)) == NULL) {
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
net->active = 1;
|
|
||||||
def = NULL;
|
def = NULL;
|
||||||
|
net->active = 1;
|
||||||
|
|
||||||
ret = virGetNetwork(conn, def->name, def->uuid);
|
ret = virGetNetwork(conn, net->def->name, net->def->uuid);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virNetworkDefFree(def);
|
virNetworkDefFree(def);
|
||||||
@ -2076,14 +2074,12 @@ static virNetworkPtr testNetworkDefine(virConnectPtr conn, const char *xml) {
|
|||||||
if ((def = virNetworkDefParseString(conn, xml)) == NULL)
|
if ((def = virNetworkDefParseString(conn, xml)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((net = virNetworkAssignDef(conn, &privconn->networks,
|
if ((net = virNetworkAssignDef(conn, &privconn->networks, def)) == NULL)
|
||||||
def)) == NULL) {
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
net->persistent = 1;
|
|
||||||
def = NULL;
|
def = NULL;
|
||||||
|
net->persistent = 1;
|
||||||
|
|
||||||
ret = virGetNetwork(conn, def->name, def->uuid);
|
ret = virGetNetwork(conn, net->def->name, net->def->uuid);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virNetworkDefFree(def);
|
virNetworkDefFree(def);
|
||||||
@ -2529,9 +2525,8 @@ testStoragePoolCreate(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def))) {
|
if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
def = NULL;
|
def = NULL;
|
||||||
|
|
||||||
if (testStoragePoolObjSetDefaults(conn, pool) == -1) {
|
if (testStoragePoolObjSetDefaults(conn, pool) == -1) {
|
||||||
@ -2568,9 +2563,8 @@ testStoragePoolDefine(virConnectPtr conn,
|
|||||||
def->allocation = defaultPoolAlloc;
|
def->allocation = defaultPoolAlloc;
|
||||||
def->available = defaultPoolCap - defaultPoolAlloc;
|
def->available = defaultPoolCap - defaultPoolAlloc;
|
||||||
|
|
||||||
if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def))) {
|
if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
def = NULL;
|
def = NULL;
|
||||||
|
|
||||||
if (testStoragePoolObjSetDefaults(conn, pool) == -1) {
|
if (testStoragePoolObjSetDefaults(conn, pool) == -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user