]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: util: steal cmd in CreateQemuImgCmdFromVol
authorJán Tomko <jtomko@redhat.com>
Fri, 10 Dec 2021 16:19:18 +0000 (17:19 +0100)
committerJán Tomko <jtomko@redhat.com>
Mon, 13 Dec 2021 17:20:46 +0000 (18:20 +0100)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/storage/storage_util.c

index ce61f3717229bf9c2c723c35d9fa41b29b725606..bfc3edb1fdbfde8e9b2fe465282bb775ce80be6e 100644 (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;
 }