summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@gnome.org>2007-12-22 21:03:40 +0000
committerChristian Persch <chpe@src.gnome.org>2007-12-22 21:03:40 +0000
commit102db3cc7d35dff9c8b6f925a7018fad9c245af3 (patch)
tree9798c794d1ae50fd7f6a167f3f0a6b4cdb42e95b
parentf23743295217601b6c7e31ad6d2493ccdec00c3e (diff)
downloadgtk+-102db3cc7d35dff9c8b6f925a7018fad9c245af3.tar.gz
Plug mem leaks. Bug #504886.
2007-12-22 Christian Persch <chpe@gnome.org> * gdk/x11/gdkscreen-x11.c: (init_randr12): Plug mem leaks. Bug #504886. svn path=/trunk/; revision=19223
-rw-r--r--ChangeLog4
-rw-r--r--gdk/x11/gdkscreen-x11.c14
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e80b04fd32..f1fe7f220f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
2007-12-22 Christian Persch <chpe@gnome.org>
+
+ * gdk/x11/gdkscreen-x11.c: (init_randr12): Plug mem leaks. Bug #504886.
+
+2007-12-22 Christian Persch <chpe@gnome.org>
* modules/other/gail/gail.c:
* modules/other/gail/gailbutton.c:
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 469f9b6c2a..5c1f36e5db 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -678,12 +678,14 @@ init_randr12 (GdkScreen *screen)
if (!display_x11->have_randr12)
return FALSE;
- monitors = g_array_new (TRUE, TRUE, sizeof (GdkX11Monitor));
-
resources = XRRGetScreenResources (screen_x11->xdisplay,
screen_x11->xroot_window);
+ if (!resources)
+ return FALSE;
- /* FIXME: can GetScreenResources return NULL except when it's out of memory? */
+ monitors = g_array_sized_new (FALSE, TRUE, sizeof (GdkX11Monitor),
+ monitors->len);
+
for (i = 0; i < resources->noutput; ++i)
{
XRROutputInfo *output =
@@ -707,14 +709,18 @@ init_randr12 (GdkScreen *screen)
monitor.manufacturer = NULL;
g_array_append_val (monitors, monitor);
+
+ XRRFreeCrtcInfo (crtc);
}
XRRFreeOutputInfo (output);
}
+ XRRFreeScreenResources (resources);
+
screen_x11->n_monitors = monitors->len;
screen_x11->monitors = (GdkX11Monitor *)g_array_free (monitors, FALSE);
-
+
return TRUE;
#endif