If the creation of the commandline failed, libvirt always reported "out
of memory" from the virCommandToString function rather than the proper
error that happened in virStorageBackendCreateQemuImgCmd. Error out
earlier.
cmd = virStorageBackendCreateQemuImgCmd(conn, &poolobj, vol, inputvol,
flags, create_tool, imgformat);
-
- actualCmdline = virCommandToString(cmd);
- if (!actualCmdline) {
+ if (!cmd) {
if (shouldFail) {
virResetLastError();
ret = 0;
goto cleanup;
}
+ if (!(actualCmdline = virCommandToString(cmd)))
+ goto cleanup;
+
len = virtTestLoadFile(cmdline, &expectedCmdline);
if (len < 0)
goto cleanup;