When cmd is NULL, virCommandToString reports an OOM error,
overwriting the error reported by virStorageBackendCreateQemuImgCmd.
---
tests/storagevolxml2argvtest.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index e1507b4..46b77b2 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -61,14 +61,14 @@ testCompareXMLToArgvFiles(bool shouldFail,
cmd = virStorageBackendCreateQemuImgCmd(conn, &poolobj, vol, inputvol,
flags, create_tool, imgformat);
- actualCmdline = virCommandToString(cmd);
- if (!actualCmdline) {
+ if (!cmd) {
if (shouldFail) {
virResetLastError();
ret = 0;
}
goto cleanup;
}
+ actualCmdline = virCommandToString(cmd);
len = virtTestLoadFile(cmdline, &expectedCmdline);
if (len < 0)
--
1.8.1.5