diff options
author | Fabiano FidĂȘncio <fidencio@redhat.com> | 2015-10-21 14:12:48 +0200 |
---|---|---|
committer | Fabiano FidĂȘncio <fidencio@redhat.com> | 2016-03-04 11:22:00 +0100 |
commit | 682c3d0f29efc6eaaa81b00d4fef32d9cf070366 (patch) | |
tree | b4b3ffde258078c5306fab70ab4942ec84de3ef6 | |
parent | 3eb37095b7cb859b48fb9a25214b2cd7adc5f626 (diff) |
session: Only create a hashtable if apply_monitor_geometry vfunc exists
Creating the monitors hashtable only after checking for the existence of
apply_monitor_geometry vfunc avoids leaking the hashtable in the case
where the vfunc doesn't exist.
Related: rhbz#1267184
(cherry picked from commit 73b55b3e1b09c81cf72082b4ec49d66c79ba7dc7)
-rw-r--r-- | src/virt-viewer-session.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c index eb7fbcd..fdd90c6 100644 --- a/src/virt-viewer-session.c +++ b/src/virt-viewer-session.c @@ -346,13 +346,15 @@ virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession* self, VirtViewerSessionClass *klass; gboolean all_fullscreen = TRUE; /* GHashTable<gint, GdkRectangle*> */ - GHashTable *monitors = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); + GHashTable *monitors; GList *l; klass = VIRT_VIEWER_SESSION_GET_CLASS(self); if (!klass->apply_monitor_geometry) return; + monitors = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); + for (l = self->priv->displays; l; l = l->next) { VirtViewerDisplay *d = VIRT_VIEWER_DISPLAY(l->data); guint nth = 0; |