1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

storage: util: steal cmd in CreateQemuImgCmdFromVol

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2021-12-10 17:19:18 +01:00
parent 42823e67dc
commit fd206c2867

View File

@ -1116,7 +1116,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObj *pool,
const char *inputSecretPath,
virStorageVolEncryptConvertStep convertStep)
{
virCommand *cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
struct _virStorageBackendQemuImgInfo info = {
.format = vol->target.format,
.type = NULL,
@ -1246,11 +1246,10 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObj *pool,
}
VIR_FREE(info.secretAlias);
return cmd;
return g_steal_pointer(&cmd);
error:
VIR_FREE(info.secretAlias);
virCommandFree(cmd);
return NULL;
}