[virt-tools-list] [PATCH virt-viewer] Set freed variables to NULL in remote_viewer_start()

Jonathon Jongsma jjongsma at redhat.com
Tue Jun 3 16:15:08 UTC 2014


Coverity warns that 'type' can sometimes be used or free after already having
been freed.  This can happen when open_recent_dialog is true and we jump back up
to the retry_dialog label.  To prevent this, make sure the freed variables are
set to NULL after freeing.
---
 src/remote-viewer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 15d576b..7e8bcc8 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -1097,7 +1097,9 @@ cleanup:
     g_clear_object(&file);
     g_clear_object(&vvfile);
     g_free(guri);
+    guri = NULL;
     g_free(type);
+    type = NULL;
 
     if (!ret && priv->open_recent_dialog) {
         goto retry_dialog;
-- 
1.9.3




More information about the virt-tools-list mailing list