summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2015-10-21 14:12:48 +0200
committerFabiano FidĂȘncio <fidencio@redhat.com>2015-10-21 15:43:15 +0200
commit73b55b3e1b09c81cf72082b4ec49d66c79ba7dc7 (patch)
tree0ebc4813d64e7938a8c9def824106e2e49cd3ddf /src
parent50f7d3dff8a343a1528902a4792323b038f45e18 (diff)
downloadvirt-viewer-73b55b3e1b09c81cf72082b4ec49d66c79ba7dc7.tar.gz
virt-viewer-73b55b3e1b09c81cf72082b4ec49d66c79ba7dc7.tar.xz
virt-viewer-73b55b3e1b09c81cf72082b4ec49d66c79ba7dc7.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/virt-viewer-session.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
index 2699f41..92ffd3f 100644
--- a/src/virt-viewer-session.c
+++ b/src/virt-viewer-session.c
@@ -405,13 +405,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;