mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-31 22:17:17 +00:00
qemu: command: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
cc3190cc4c
commit
7195877348
@ -7428,8 +7428,7 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
|
|||||||
hmat = true;
|
hmat = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC_N(nodeBackends, ncells) < 0)
|
nodeBackends = g_new0(virBuffer, ncells);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* using of -numa memdev= cannot be combined with -numa mem=, thus we
|
/* using of -numa memdev= cannot be combined with -numa mem=, thus we
|
||||||
* need to check which approach to use */
|
* need to check which approach to use */
|
||||||
@ -8119,9 +8118,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
|
|||||||
if (!tapfdSize)
|
if (!tapfdSize)
|
||||||
tapfdSize = 1;
|
tapfdSize = 1;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(tapfd, tapfdSize) < 0 ||
|
tapfd = g_new0(int, tapfdSize);
|
||||||
VIR_ALLOC_N(tapfdName, tapfdSize) < 0)
|
tapfdName = g_new0(char *, tapfdSize);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
memset(tapfd, -1, tapfdSize * sizeof(tapfd[0]));
|
memset(tapfd, -1, tapfdSize * sizeof(tapfd[0]));
|
||||||
|
|
||||||
@ -8135,9 +8133,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
|
|||||||
if (!tapfdSize)
|
if (!tapfdSize)
|
||||||
tapfdSize = 1;
|
tapfdSize = 1;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(tapfd, tapfdSize) < 0 ||
|
tapfd = g_new0(int, tapfdSize);
|
||||||
VIR_ALLOC_N(tapfdName, tapfdSize) < 0)
|
tapfdName = g_new0(char *, tapfdSize);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
memset(tapfd, -1, tapfdSize * sizeof(tapfd[0]));
|
memset(tapfd, -1, tapfdSize * sizeof(tapfd[0]));
|
||||||
|
|
||||||
@ -8151,9 +8148,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
|
|||||||
if (!tapfdSize)
|
if (!tapfdSize)
|
||||||
tapfdSize = 1;
|
tapfdSize = 1;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(tapfd, tapfdSize) < 0 ||
|
tapfd = g_new0(int, tapfdSize);
|
||||||
VIR_ALLOC_N(tapfdName, tapfdSize) < 0)
|
tapfdName = g_new0(char *, tapfdSize);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
memset(tapfd, -1, tapfdSize * sizeof(tapfd[0]));
|
memset(tapfd, -1, tapfdSize * sizeof(tapfd[0]));
|
||||||
|
|
||||||
@ -8268,9 +8264,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
|
|||||||
if (!vhostfdSize)
|
if (!vhostfdSize)
|
||||||
vhostfdSize = 1;
|
vhostfdSize = 1;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0 ||
|
vhostfd = g_new0(int, vhostfdSize);
|
||||||
VIR_ALLOC_N(vhostfdName, vhostfdSize))
|
vhostfdName = g_new0(char *, vhostfdSize);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
memset(vhostfd, -1, vhostfdSize * sizeof(vhostfd[0]));
|
memset(vhostfd, -1, vhostfdSize * sizeof(vhostfd[0]));
|
||||||
|
|
||||||
@ -10465,8 +10460,7 @@ qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk,
|
|||||||
{
|
{
|
||||||
g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
|
g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(qemuBlockStorageSourceAttachData, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!(data->driveCmd = qemuBuildDriveStr(disk, qemuCaps)) ||
|
if (!(data->driveCmd = qemuBuildDriveStr(disk, qemuCaps)) ||
|
||||||
!(data->driveAlias = qemuAliasDiskDriveFromDisk(disk)))
|
!(data->driveAlias = qemuAliasDiskDriveFromDisk(disk)))
|
||||||
@ -10543,8 +10537,7 @@ qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk,
|
|||||||
g_autoptr(qemuBlockStorageSourceAttachData) elem = NULL;
|
g_autoptr(qemuBlockStorageSourceAttachData) elem = NULL;
|
||||||
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
|
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(qemuBlockStorageSourceChainData, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!(elem = qemuBuildStorageSourceAttachPrepareDrive(disk, qemuCaps)))
|
if (!(elem = qemuBuildStorageSourceAttachPrepareDrive(disk, qemuCaps)))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -10595,8 +10588,7 @@ qemuBuildStorageSourceChainAttachPrepareBlockdev(virStorageSourcePtr top,
|
|||||||
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
|
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
|
||||||
virStorageSourcePtr n;
|
virStorageSourcePtr n;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(qemuBlockStorageSourceChainData, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (n = top; virStorageSourceIsBacking(n); n = n->backingStore) {
|
for (n = top; virStorageSourceIsBacking(n); n = n->backingStore) {
|
||||||
if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n,
|
if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n,
|
||||||
@ -10625,8 +10617,7 @@ qemuBuildStorageSourceChainAttachPrepareBlockdevTop(virStorageSourcePtr top,
|
|||||||
{
|
{
|
||||||
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
|
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(qemuBlockStorageSourceChainData, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, top, backingStore,
|
if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, top, backingStore,
|
||||||
qemuCaps) < 0)
|
qemuCaps) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user