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
This commit is contained in:
Christian Persch 2007-12-22 21:03:40 +00:00 committed by Christian Persch
parent f237432952
commit 102db3cc7d
2 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,7 @@
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:

View File

@ -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