提交 f98b9e05 编写于 作者: J Jim Meyering

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->.
上级 6efe591e
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>
usleep to wait for domain logfile to fill up
......
......@@ -2049,14 +2049,12 @@ static virNetworkPtr testNetworkCreate(virConnectPtr conn, const char *xml) {
if ((def = virNetworkDefParseString(conn, xml)) == NULL)
goto cleanup;
if ((net = virNetworkAssignDef(conn, &privconn->networks,
def)) == NULL) {
if ((net = virNetworkAssignDef(conn, &privconn->networks, def)) == NULL)
goto cleanup;
}
net->active = 1;
def = NULL;
net->active = 1;
ret = virGetNetwork(conn, def->name, def->uuid);
ret = virGetNetwork(conn, net->def->name, net->def->uuid);
cleanup:
virNetworkDefFree(def);
......@@ -2076,14 +2074,12 @@ static virNetworkPtr testNetworkDefine(virConnectPtr conn, const char *xml) {
if ((def = virNetworkDefParseString(conn, xml)) == NULL)
goto cleanup;
if ((net = virNetworkAssignDef(conn, &privconn->networks,
def)) == NULL) {
if ((net = virNetworkAssignDef(conn, &privconn->networks, def)) == NULL)
goto cleanup;
}
net->persistent = 1;
def = NULL;
net->persistent = 1;
ret = virGetNetwork(conn, def->name, def->uuid);
ret = virGetNetwork(conn, net->def->name, net->def->uuid);
cleanup:
virNetworkDefFree(def);
......@@ -2529,9 +2525,8 @@ testStoragePoolCreate(virConnectPtr conn,
goto cleanup;
}
if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def))) {
if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def)))
goto cleanup;
}
def = NULL;
if (testStoragePoolObjSetDefaults(conn, pool) == -1) {
......@@ -2568,9 +2563,8 @@ testStoragePoolDefine(virConnectPtr conn,
def->allocation = defaultPoolAlloc;
def->available = defaultPoolCap - defaultPoolAlloc;
if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def))) {
if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def)))
goto cleanup;
}
def = NULL;
if (testStoragePoolObjSetDefaults(conn, pool) == -1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册