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

[virt-tools-list] [virt-viewer 2/3] Fix various memory leaks



==25063== 59 bytes in 1 blocks are definitely lost in loss record 5,163 of 9,502
==25063==    at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==25063==    by 0x3DE384D2BE: g_malloc (gmem.c:159)
==25063==    by 0x3DE3862D0B: g_strdup (gstrfuncs.c:356)
==25063==    by 0x41F40A: connected (remote-viewer-main.c:186)
==25063==    by 0x3DE400F663: g_closure_invoke (gclosure.c:777)
==25063==    by 0x3DE40206D7: signal_emit_unlocked_R (gsignal.c:3547)
==25063==    by 0x3DE402866C: g_signal_emit_valist (gsignal.c:3296)
==25063==    by 0x3DE4028CCF: g_signal_emit_by_name (gsignal.c:3389)
==25063==    by 0x41AA53: reemit_signal_VOID (virt-viewer-session-ovirt.c:211)
==25063==    by 0x3DE400F942: _g_closure_invoke_va (gclosure.c:840)
==25063==    by 0x3DE4027D87: g_signal_emit_valist (gsignal.c:3207)
==25063==    by 0x3DE4028CCF: g_signal_emit_by_name (gsignal.c:3389)

==25063== 14 bytes in 1 blocks are definitely lost in loss record 623 of 9,502
==25063==    at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==25063==    by 0x34561092F7: __vasprintf_chk (vasprintf_chk.c:82)
==25063==    by 0x3DE3882F1A: g_vasprintf (stdio2.h:199)
==25063==    by 0x3DE3862EDC: g_strdup_vprintf (gstrfuncs.c:509)
==25063==    by 0x3DE3862F7B: g_strdup_printf (gstrfuncs.c:535)
==25063==    by 0x40CBAE: virt_viewer_app_update_pretty_address (virt-viewer-app.c:1538)
==25063==    by 0x40FB55: virt_viewer_app_free_connect_info (virt-viewer-app.c:1707)
==25063==    by 0x40FBE9: virt_viewer_app_dispose (virt-viewer-app.c:1291)
==25063==    by 0x3DE40144F7: g_object_unref (gobject.c:2981)
==25063==    by 0x40C31A: main (remote-viewer-main.c:336)

==25063== 10 bytes in 1 blocks are definitely lost in loss record 491 of 9,502
==25063==    at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==25063==    by 0x34561092F7: __vasprintf_chk (vasprintf_chk.c:82)
==25063==    by 0x3DE3882F1A: g_vasprintf (stdio2.h:199)
==25063==    by 0x3DE3862EDC: g_strdup_vprintf (gstrfuncs.c:509)
==25063==    by 0x3DE3862F7B: g_strdup_printf (gstrfuncs.c:535)
==25063==    by 0x40DE36: window_update_menu_displays_cb (virt-viewer-app.c:1640)
==25063==    by 0x3DE383833F: g_hash_table_foreach (ghash.c:1524)
==25063==    by 0x3DE400F663: g_closure_invoke (gclosure.c:777)
==25063==    by 0x3DE40206D7: signal_emit_unlocked_R (gsignal.c:3547)
==25063==    by 0x3DE402866C: g_signal_emit_valist (gsignal.c:3296)
==25063==    by 0x3DE40287C1: g_signal_emit (gsignal.c:3352)
==25063==    by 0x5772F95: gtk_widget_show (gtkwidget.c:3225)

==25063== 8,431 (72 direct, 8,359 indirect) bytes in 1 blocks are definitely lost in loss record 9,468 of 9,502
==25063==    at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==25063==    by 0x3DE384D2BE: g_malloc (gmem.c:159)
==25063==    by 0x3DE38616B1: g_slice_alloc (gslice.c:1003)
==25063==    by 0x3DE3861C05: g_slice_alloc0 (gslice.c:1029)
==25063==    by 0x3DE402F96F: g_type_create_instance (gtype.c:1872)
==25063==    by 0x3DE40147A7: g_object_constructor (gobject.c:1849)
==25063==    by 0x3DE4016260: g_object_newv (gobject.c:1632)
==25063==    by 0x3DE40168AB: g_object_new (gobject.c:1542)
==25063==    by 0x40C4BD: virt_viewer_util_load_ui (virt-viewer-util.c:41)
==25063==    by 0x40C7EB: virt_viewer_auth_collect_credentials (virt-viewer-auth.c:43)
==25063==    by 0x41B391: authenticate_cb (virt-viewer-session-ovirt.c:430)
==25063==    by 0x3458C05E8F: ffi_call_unix64 (unix64.S:75)

==25063== 32 (16 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 3,962 of 9,502
==25063==    at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==25063==    by 0x3DE384D2BE: g_malloc (gmem.c:159)
==25063==    by 0x3DE38616B1: g_slice_alloc (gslice.c:1003)
==25063==    by 0x3DE38629F2: g_slist_append (gslist.c:222)
==25063==    by 0x41483C: virt_viewer_window_init (virt-viewer-window.c:323)
==25063==    by 0x3DE402FA05: g_type_create_instance (gtype.c:1892)
==25063==    by 0x3DE40147A7: g_object_constructor (gobject.c:1849)
==25063==    by 0x3DE4015D70: g_object_newv (gobject.c:1713)
==25063==    by 0x3DE401655F: g_object_new_valist (gobject.c:1830)
==25063==    by 0x3DE4016893: g_object_new (gobject.c:1545)
==25063==    by 0x40DA34: virt_viewer_app_window_new (virt-viewer-app.c:590)
==25063==    by 0x40E300: virt_viewer_app_constructor (virt-viewer-app.c:1336)

==30355== 4 bytes in 1 blocks are definitely lost in loss record 53 of 9,267
==30355==    at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==30355==    by 0x3DE384D2BE: g_malloc (gmem.c:159)
==30355==    by 0x3DE3862D0B: g_strdup (gstrfuncs.c:356)
==30355==    by 0x3DE40360FC: value_copy_string (gvaluetypes.c:276)
==30355==    by 0x3DE40340CA: g_value_transform (gvalue.c:535)
==30355==    by 0x3FDAE621DD: gdk_screen_get_setting (gdkevents-x11.c:3022)
==30355==    by 0x3FDB3C7415: gtk_settings_get_property (gtksettings.c:1152)
==30355==    by 0x3DE4017A74: g_object_get_property (gobject.c:1289)
==30355==    by 0x414991: virt_viewer_window_disable_modifiers (virt-viewer-window.c:616)
==30355==    by 0x415922: virt_viewer_window_keyboard_grab (virt-viewer-window.c:931)
==30355==    by 0x3DE400F942: _g_closure_invoke_va (gclosure.c:840)
==30355==    by 0x3DE4027D87: g_signal_emit_valist (gsignal.c:3207)
---
 src/remote-viewer-main.c |    1 +
 src/virt-viewer-app.c    |   14 +++++++++++++-
 src/virt-viewer-auth.c   |    1 +
 src/virt-viewer-window.c |   10 ++++++++++
 4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c
index b260c85..156bd0b 100644
--- a/src/remote-viewer-main.c
+++ b/src/remote-viewer-main.c
@@ -184,6 +184,7 @@ static void connected(VirtViewerSession *session,
     gchar *uri = virt_viewer_session_get_uri(session);
 
     recent_add(uri);
+    g_free(uri);
 }
 
 int
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index b2f42ca..40d1ff7 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1273,6 +1273,15 @@ virt_viewer_app_dispose (GObject *object)
         priv->session = NULL;
     }
     g_free(priv->title);
+    priv->title = NULL;
+    g_free(priv->guest_name);
+    priv->guest_name = NULL;
+    g_free(priv->pretty_address);
+    priv->pretty_address = NULL;
+    g_free(priv->guri);
+    priv->guri = NULL;
+    g_free(priv->title);
+    priv->title = NULL;
 
     virt_viewer_app_free_connect_info(self);
 
@@ -1622,8 +1631,11 @@ window_update_menu_displays_cb(gpointer key G_GNUC_UNUSED,
         VirtViewerWindow *vwin = VIRT_VIEWER_WINDOW(g_hash_table_lookup(self->priv->windows, nth));
         GtkWidget *item;
         gboolean visible;
+        gchar *label;
 
-        item = gtk_check_menu_item_new_with_label(g_strdup_printf("Display %d", *nth));
+        label = g_strdup_printf("Display %d", *nth);
+        item = gtk_check_menu_item_new_with_label(label);
+        g_free(label);
         visible = gtk_widget_get_visible(GTK_WIDGET(virt_viewer_window_get_window(vwin)));
         gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), visible);
         g_signal_connect(G_OBJECT(item),
diff --git a/src/virt-viewer-auth.c b/src/virt-viewer-auth.c
index 8c4041d..487e67c 100644
--- a/src/virt-viewer-auth.c
+++ b/src/virt-viewer-auth.c
@@ -89,6 +89,7 @@ virt_viewer_auth_collect_credentials(GtkWindow *window,
     }
 
     gtk_widget_destroy(GTK_WIDGET(dialog));
+    g_object_unref(G_OBJECT(creds));
 
     return response == GTK_RESPONSE_OK ? 0 : -1;
 }
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index ab82558..7b582a0 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -172,6 +172,8 @@ static void
 virt_viewer_window_dispose (GObject *object)
 {
     VirtViewerWindowPrivate *priv = VIRT_VIEWER_WINDOW(object)->priv;
+    GSList *it;
+
     G_OBJECT_CLASS (virt_viewer_window_parent_class)->dispose (object);
 
     if (priv->display) {
@@ -190,8 +192,16 @@ virt_viewer_window_dispose (GObject *object)
         priv->builder = NULL;
     }
 
+    for (it = priv->accel_list ; it != NULL ; it = it->next) {
+        g_object_unref(G_OBJECT(it->data));
+    }
+    g_slist_free(priv->accel_list);
+    priv->accel_list = NULL;
+
     g_free(priv->subtitle);
     priv->subtitle = NULL;
+
+    g_value_unset(&priv->accel_setting);
 }
 
 static void
-- 
1.7.10.2


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