GNOME Bugzilla – Bug 678738
atspi-misc: Prevent leak
Last modified: 2012-06-25 18:10:27 UTC
See patch.
Created attachment 217152 [details] [review] atspi-misc: Prevent leak We need to free the data that XGetWindowProperty returns back to us.
Comment on attachment 217152 [details] [review] atspi-misc: Prevent leak >From 03735f29efce2a67263e8c1576f6c6a706ddfa75 Mon Sep 17 00:00:00 2001 >From: "Jasper St. Pierre" <jstpierre@mecheye.net> >Date: Sun, 24 Jun 2012 16:32:31 -0400 >Subject: [PATCH] atspi-misc: Prevent leak > >We need to free the data that XGetWindowProperty returns back to us. > >https://bugzilla.gnome.org/show_bug.cgi?id=678738 >--- > atspi/atspi-misc.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > >diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c >index 6589843..ea132fb 100644 >--- a/atspi/atspi-misc.c >+++ b/atspi/atspi-misc.c >@@ -1355,7 +1355,8 @@ get_accessibility_bus_address_x11 (void) > Atom actual_type; > Display *bridge_display; > int actual_format; >- unsigned char *data = NULL; >+ char *data; >+ unsigned char *data_x11 = NULL; > unsigned long nitems; > unsigned long leftover; > >@@ -1372,10 +1373,12 @@ get_accessibility_bus_address_x11 (void) > AT_SPI_BUS, 0L, > (long) BUFSIZ, False, > (Atom) 31, &actual_type, &actual_format, >- &nitems, &leftover, &data); >+ &nitems, &leftover, &data_x11); > XCloseDisplay (bridge_display); > >- return g_strdup (data); >+ data = g_strdup (data_x11); >+ XFree (data_x11); >+ return data; > } > > static char * >-- >1.7.10.2
Committed (c3d236). Thanks for the patch.