[PATCH 24/39] virStorageBackendZFSRefreshPool: Reduce scope of 'tokens'

Peter Krempa pkrempa at redhat.com
Thu Apr 1 13:52:23 UTC 2021


Declare it in the loop that actually uses it.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/storage/storage_backend_zfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backend_zfs.c
index cab1fd1637..6fed25cf4d 100644
--- a/src/storage/storage_backend_zfs.c
+++ b/src/storage/storage_backend_zfs.c
@@ -216,7 +216,6 @@ virStorageBackendZFSRefreshPool(virStoragePoolObjPtr pool G_GNUC_UNUSED)
     size_t i;
     g_autoptr(virCommand) cmd = NULL;
     g_auto(GStrv) lines = NULL;
-    g_auto(GStrv) tokens = NULL;
     g_autofree char *name = g_strdup(def->source.name);
     char *tmp;

@@ -246,13 +245,13 @@ virStorageBackendZFSRefreshPool(virStoragePoolObjPtr pool G_GNUC_UNUSED)
         goto cleanup;

     for (i = 0; lines[i]; i++) {
+        g_auto(GStrv) tokens = NULL;
         size_t count;
         char *prop_name;

         if (STREQ(lines[i], ""))
             continue;

-        g_strfreev(tokens);
         if (!(tokens = virStringSplitCount(lines[i], "\t", 0, &count)))
             goto cleanup;

-- 
2.29.2




More information about the libvir-list mailing list