[libvirt PATCH 04/21] util: Use glib memory functions in virErrorCopyNew

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/util/virerror.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/util/virerror.c b/src/util/virerror.c
index 507a29f50f..4ba99defbb 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -223,15 +223,14 @@ virCopyError(virErrorPtr from,
 virErrorPtr
 virErrorCopyNew(virErrorPtr err)
 {
-    virErrorPtr ret;
+    g_autoptr(virError) ret = NULL;
 
-    if (VIR_ALLOC_QUIET(ret) < 0)
-        return NULL;
+    ret = g_new0(virError, 1);
 
     if (virCopyError(err, ret) < 0)
-        VIR_FREE(ret);
+        return NULL;
 
-    return ret;
+    return g_steal_pointer(&ret);
 }
 
 
-- 
2.26.2




[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