[libvirt PATCH 2/6] tests: esxutils: reduce variable scope in testEscapeDatastoreItem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Also use g_auto.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 tests/esxutilstest.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c
index bfb35fa356..d537da3011 100644
--- a/tests/esxutilstest.c
+++ b/tests/esxutilstest.c
@@ -161,23 +161,19 @@ static int
 testEscapeDatastoreItem(const void *data G_GNUC_UNUSED)
 {
     size_t i;
-    char *escaped = NULL;
 
     for (i = 0; i < G_N_ELEMENTS(datastoreItems); ++i) {
-        VIR_FREE(escaped);
+        g_autofree char *escaped = NULL;
 
         escaped = esxUtil_EscapeDatastoreItem(datastoreItems[i].string);
 
         if (escaped == NULL)
             return -1;
 
-        if (STRNEQ(datastoreItems[i].escaped, escaped)) {
-            VIR_FREE(escaped);
+        if (STRNEQ(datastoreItems[i].escaped, escaped))
             return -1;
-        }
     }
 
-    VIR_FREE(escaped);
     return 0;
 }
 
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux