mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-29 17:33:09 +00:00
fix inadequate initialization in storage and test drivers
* src/storage_driver.c (storageListPools): Set all "names" entries to 0. (storageListDefinedPools, storagePoolListVolumes): Likewise. * src/test.c (testStoragePoolListVolumes): Likewise.
This commit is contained in:
parent
a904a56c36
commit
fa4fc0321a
@ -1,3 +1,10 @@
|
|||||||
|
Tue, 2 Dec 2008 16:58:16 +0100 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
|
fix inadequate initialization in storage and test drivers
|
||||||
|
* src/storage_driver.c (storageListPools): Set all "names" entries to 0.
|
||||||
|
(storageListDefinedPools, storagePoolListVolumes): Likewise.
|
||||||
|
* src/test.c (testStoragePoolListVolumes): Likewise.
|
||||||
|
|
||||||
Tue Dec 2 13:45:00 CET 2008 Chris Lalancette <clalance@redhat.com>
|
Tue Dec 2 13:45:00 CET 2008 Chris Lalancette <clalance@redhat.com>
|
||||||
* configure.in, src/storage_backend.c: Older distributions (i.e.
|
* configure.in, src/storage_backend.c: Older distributions (i.e.
|
||||||
RHEL-5) don't have udevadm at all, but they do have udevsettle. So
|
RHEL-5) don't have udevadm at all, but they do have udevsettle. So
|
||||||
|
@ -347,7 +347,7 @@ storageListPools(virConnectPtr conn,
|
|||||||
free(names[i]);
|
free(names[i]);
|
||||||
names[i] = NULL;
|
names[i] = NULL;
|
||||||
}
|
}
|
||||||
memset(names, 0, nnames);
|
memset(names, 0, nnames * sizeof(*names));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ storageListDefinedPools(virConnectPtr conn,
|
|||||||
free(names[i]);
|
free(names[i]);
|
||||||
names[i] = NULL;
|
names[i] = NULL;
|
||||||
}
|
}
|
||||||
memset(names, 0, nnames);
|
memset(names, 0, nnames * sizeof(*names));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -880,7 +880,7 @@ storagePoolListVolumes(virStoragePoolPtr obj,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(names, 0, maxnames);
|
memset(names, 0, maxnames * sizeof(*names));
|
||||||
for (i = 0 ; i < pool->volumes.count && n < maxnames ; i++) {
|
for (i = 0 ; i < pool->volumes.count && n < maxnames ; i++) {
|
||||||
if ((names[n++] = strdup(pool->volumes.objs[i]->name)) == NULL) {
|
if ((names[n++] = strdup(pool->volumes.objs[i]->name)) == NULL) {
|
||||||
virStorageReportError(obj->conn, VIR_ERR_NO_MEMORY,
|
virStorageReportError(obj->conn, VIR_ERR_NO_MEMORY,
|
||||||
@ -895,7 +895,7 @@ storagePoolListVolumes(virStoragePoolPtr obj,
|
|||||||
for (n = 0 ; n < maxnames ; n++)
|
for (n = 0 ; n < maxnames ; n++)
|
||||||
VIR_FREE(names[i]);
|
VIR_FREE(names[i]);
|
||||||
|
|
||||||
memset(names, 0, maxnames);
|
memset(names, 0, maxnames * sizeof(*names));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1951,7 +1951,7 @@ testStoragePoolListVolumes(virStoragePoolPtr obj,
|
|||||||
POOL_IS_ACTIVE(privpool, -1);
|
POOL_IS_ACTIVE(privpool, -1);
|
||||||
int i = 0, n = 0;
|
int i = 0, n = 0;
|
||||||
|
|
||||||
memset(names, 0, maxnames);
|
memset(names, 0, maxnames * sizeof(*names));
|
||||||
for (i = 0 ; i < privpool->volumes.count && n < maxnames ; i++) {
|
for (i = 0 ; i < privpool->volumes.count && n < maxnames ; i++) {
|
||||||
if ((names[n++] = strdup(privpool->volumes.objs[i]->name)) == NULL) {
|
if ((names[n++] = strdup(privpool->volumes.objs[i]->name)) == NULL) {
|
||||||
testError(obj->conn, VIR_ERR_NO_MEMORY, "%s", _("name"));
|
testError(obj->conn, VIR_ERR_NO_MEMORY, "%s", _("name"));
|
||||||
@ -1965,7 +1965,7 @@ testStoragePoolListVolumes(virStoragePoolPtr obj,
|
|||||||
for (n = 0 ; n < maxnames ; n++)
|
for (n = 0 ; n < maxnames ; n++)
|
||||||
VIR_FREE(names[i]);
|
VIR_FREE(names[i]);
|
||||||
|
|
||||||
memset(names, 0, maxnames);
|
memset(names, 0, maxnames * sizeof(*names));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user