Reduce the scope of the variable to avoid mixing automatic and manual
cleanup.

Signed-off-by: Ján Tomko <jto...@redhat.com>
---
 tests/storagevolxml2argvtest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index 9597509f00..94e2de1730 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -50,7 +50,6 @@ testCompareXMLToArgvFiles(bool shouldFail,
     g_autoptr(virStorageVolDef) vol = NULL;
     g_autoptr(virStorageVolDef) inputvol = NULL;
     g_autoptr(virStoragePoolDef) inputpool = NULL;
-    g_autoptr(virCommand) cmd = NULL;
 
     if (!(def = virStoragePoolDefParseFile(poolxml)))
         goto cleanup;
@@ -88,7 +87,8 @@ testCompareXMLToArgvFiles(bool shouldFail,
         convertStep = VIR_STORAGE_VOL_ENCRYPT_CREATE;
 
     do {
-        virCommandFree(cmd);
+        g_autoptr(virCommand) cmd = NULL;
+
         cmd = virStorageBackendCreateQemuImgCmdFromVol(obj, vol,
                                                        inputvol, flags,
                                                        create_tool,
-- 
2.31.1

Reply via email to