[libvirt PATCH 1/3] virmacmap: Use g_autofree in virMacMapWriteFileLocked

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

 



Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/util/virmacmap.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/util/virmacmap.c b/src/util/virmacmap.c
index 0c0ba90def..4a57edede8 100644
--- a/src/util/virmacmap.c
+++ b/src/util/virmacmap.c
@@ -261,19 +261,15 @@ static int
 virMacMapWriteFileLocked(virMacMapPtr mgr,
                          const char *file)
 {
-    char *str;
-    int ret = -1;
+    g_autofree char *str = NULL;
 
     if (virMacMapDumpStrLocked(mgr, &str) < 0)
-        goto cleanup;
+        return -1;
 
     if (virFileRewriteStr(file, 0644, str) < 0)
-        goto cleanup;
+        return -1;
 
-    ret = 0;
- cleanup:
-    VIR_FREE(str);
-    return ret;
+    return 0;
 }
 
 
-- 
2.24.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