提交 9e1a8298 编写于 作者: J Jonathon Jongsma 提交者: Michal Privoznik

qemu: use glib alloc in qemuAgentGetFSInfoFillDisks()

Signed-off-by: NJonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 3c436c22
......@@ -1894,10 +1894,8 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
ndisks = virJSONValueArraySize(jsondisks);
if (ndisks &&
VIR_ALLOC_N(fsinfo->disks, ndisks) < 0)
return -1;
if (ndisks)
fsinfo->disks = g_new0(qemuAgentDiskInfoPtr, ndisks);
fsinfo->ndisks = ndisks;
for (i = 0; i < fsinfo->ndisks; i++) {
......@@ -1914,8 +1912,7 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks,
return -1;
}
if (VIR_ALLOC(fsinfo->disks[i]) < 0)
return -1;
fsinfo->disks[i] = g_new0(qemuAgentDiskInfo, 1);
disk = fsinfo->disks[i];
if ((val = virJSONValueObjectGetString(jsondisk, "bus-type")))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册