Also use g_auto.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
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