ack ----- Original Message ----- > The VirtViewerApp::windows hash table owns the memory for both the keys > and values it stores. virt_viewer_app_remove_nth_window() uses > g_hash_table_steal() which does not call the 'free' function neither for > the key nor for the value. This method takes care of releasing the > reference for the value it extracted from the hash table, but not for the > key. > This commit fixes by explicitly taking a reference on the value rather than > stealing the one held by the hash table. We can then replace the use of > g_hash_table_steal() with g_hash_table_remove() which will take care of > freeing the removed key. > --- > src/virt-viewer-app.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c > index c0d3e42..eddd436 100644 > --- a/src/virt-viewer-app.c > +++ b/src/virt-viewer-app.c > @@ -591,7 +591,8 @@ virt_viewer_app_remove_nth_window(VirtViewerApp *self, > gint nth) > g_return_val_if_fail(win != NULL, FALSE); > > DEBUG_LOG("Remove window %d %p", nth, win); > - removed = g_hash_table_steal(self->priv->windows, &nth); > + g_object_ref(win); > + removed = g_hash_table_remove(self->priv->windows, &nth); > g_warn_if_fail(removed); > virt_viewer_app_update_menu_displays(self); > > -- > 1.8.4.2 > > _______________________________________________ > virt-tools-list mailing list > virt-tools-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/virt-tools-list > _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list