[libgovirt] proxy: Don't try to unref NULL root node



commit 8a658f4abf522291e5dfe53dfb973456504ba34e
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Fri Dec 21 13:15:16 2018 +0100

    proxy: Don't try to unref NULL root node
    
    When an error occurs, we may have failed to get any data, so 'root' may
    be NULL. Trying to unref it triggers a critical. This happens for
    example when trying to connect to a remote host with an invalid
    certificate.

 govirt/ovirt-proxy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index 2157188..b51d0a3 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -251,7 +251,9 @@ static void rest_call_async_set_error(RestProxyCall *call, GSimpleAsyncResult *r
         g_simple_async_result_set_from_error(result, error);
     }
 
-    rest_xml_node_unref(root);
+    if (root != NULL) {
+        rest_xml_node_unref(root);
+    }
 }
 
 static void


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