[virt-tools-list] [virt-viewer][PATCH 2/4 v2] Set freed priv->dom to NULL in _dispose()

Fabiano Fidêncio fidencio at redhat.com
Wed Nov 19 15:05:45 UTC 2014


Avoid a possible use/free after the object has been freed.
---
 src/virt-viewer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 02385db..dcc64e9 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -538,8 +538,10 @@ virt_viewer_dispose (GObject *object)
         virConnectClose(priv->conn);
         priv->conn = NULL;
     }
-    if (priv->dom)
+    if (priv->dom) {
         virDomainFree(priv->dom);
+        priv->dom = NULL;
+    }
     g_free(priv->uri);
     priv->uri = NULL;
     g_free(priv->domkey);
-- 
2.1.0




More information about the virt-tools-list mailing list