After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 678738 - atspi-misc: Prevent leak
atspi-misc: Prevent leak
Status: RESOLVED FIXED
Product: at-spi
Classification: Platform
Component: at-spi2-core
unspecified
Other All
: Normal normal
: ---
Assigned To: Li Yuan
At-spi maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-06-24 20:49 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2012-06-25 18:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
atspi-misc: Prevent leak (1.20 KB, patch)
2012-06-24 20:49 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2012-06-24 20:49:14 UTC
See patch.
Comment 1 Jasper St. Pierre (not reading bugmail) 2012-06-24 20:49:15 UTC
Created attachment 217152 [details] [review]
atspi-misc: Prevent leak

We need to free the data that XGetWindowProperty returns back to us.
Comment 2 Mike Gorse 2012-06-25 18:09:24 UTC
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
Comment 3 Mike Gorse 2012-06-25 18:10:27 UTC
Committed (c3d236).
Thanks for the patch.