提交 9219424f 编写于 作者: P Peter Krempa

qemuDomainSaveImageOpen: Use 'g_new0' instead of VIR_ALLOC(_N)

Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 db907a4d
...@@ -6717,8 +6717,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, ...@@ -6717,8 +6717,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
VIR_FILE_WRAPPER_BYPASS_CACHE))) VIR_FILE_WRAPPER_BYPASS_CACHE)))
goto error; goto error;
if (VIR_ALLOC(data) < 0) data = g_new0(virQEMUSaveData, 1);
goto error;
header = &data->header; header = &data->header;
if (saferead(fd, header, sizeof(*header)) != sizeof(*header)) { if (saferead(fd, header, sizeof(*header)) != sizeof(*header)) {
...@@ -6783,8 +6782,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, ...@@ -6783,8 +6782,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
cookie_len = header->data_len - xml_len; cookie_len = header->data_len - xml_len;
if (VIR_ALLOC_N(data->xml, xml_len) < 0) data->xml = g_new0(char, xml_len);
goto error;
if (saferead(fd, data->xml, xml_len) != xml_len) { if (saferead(fd, data->xml, xml_len) != xml_len) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
...@@ -6793,8 +6791,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, ...@@ -6793,8 +6791,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
} }
if (cookie_len > 0) { if (cookie_len > 0) {
if (VIR_ALLOC_N(data->cookie, cookie_len) < 0) data->cookie = g_new0(char, cookie_len);
goto error;
if (saferead(fd, data->cookie, cookie_len) != cookie_len) { if (saferead(fd, data->cookie, cookie_len) != cookie_len) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s", virReportError(VIR_ERR_OPERATION_FAILED, "%s",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册