提交 21c6cfc2 编写于 作者: C Chris Lalancette

Fix printing of pathnames on error in qemuDomainSnapshotLoad.

While doing some testing of the snapshot code I noticed that
if qemuDomainSnapshotLoad failed, it would print a NULL as
part of the error.  That's not desirable, so leave the
full_path variable around until after we are done printing
errors.
Signed-off-by: NChris Lalancette <clalance@redhat.com>
上级 5993321d
...@@ -1388,11 +1388,11 @@ static void qemuDomainSnapshotLoad(void *payload, ...@@ -1388,11 +1388,11 @@ static void qemuDomainSnapshotLoad(void *payload,
} }
ret = virFileReadAll(fullpath, 1024*1024*1, &xmlStr); ret = virFileReadAll(fullpath, 1024*1024*1, &xmlStr);
VIR_FREE(fullpath);
if (ret < 0) { if (ret < 0) {
/* Nothing we can do here, skip this one */ /* Nothing we can do here, skip this one */
VIR_ERROR("Failed to read snapshot file %s: %s", fullpath, VIR_ERROR("Failed to read snapshot file %s: %s", fullpath,
virStrerror(errno, ebuf, sizeof(ebuf))); virStrerror(errno, ebuf, sizeof(ebuf)));
VIR_FREE(fullpath);
continue; continue;
} }
...@@ -1400,12 +1400,14 @@ static void qemuDomainSnapshotLoad(void *payload, ...@@ -1400,12 +1400,14 @@ static void qemuDomainSnapshotLoad(void *payload,
if (def == NULL) { if (def == NULL) {
/* Nothing we can do here, skip this one */ /* Nothing we can do here, skip this one */
VIR_ERROR("Failed to parse snapshot XML from file '%s'", fullpath); VIR_ERROR("Failed to parse snapshot XML from file '%s'", fullpath);
VIR_FREE(fullpath);
VIR_FREE(xmlStr); VIR_FREE(xmlStr);
continue; continue;
} }
virDomainSnapshotAssignDef(&vm->snapshots, def); virDomainSnapshotAssignDef(&vm->snapshots, def);
VIR_FREE(fullpath);
VIR_FREE(xmlStr); VIR_FREE(xmlStr);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册