From d935a3c337fd807115bc4053098cbd9925d0cfc4 Mon Sep 17 00:00:00 2001 From: billh Date: Mon, 27 Feb 2006 22:21:04 +0000 Subject: [PATCH] Revved to 1.7.6; fix leaks noted in bug #331924. Thanks to Kjartan for finding them initially. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@797 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- ChangeLog | 24 ++++++++++++++++++++++++ atk-bridge/bridge.c | 10 ++++++---- configure.in | 2 +- libspi/util.c | 4 ++-- registryd/registry.c | 4 ++++ 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5076016..6d60ea3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,29 @@ 2006-02-20 Bill Haneman + * configure.in: Rev to 1.7.6. + + Leak fixes for bug #331924. + + * atk-bridge/bridge.c: + (spi_atk_bridge_init_base): Don't dup the string, it's already + been dup-ed. Fixes a leak. + (spi_atk_emit_eventv): Move the CORBA_free call here, + instead of spi_atk_state_event_listener; fixes another leak. + (spi_atk_bridge_key_listener):Free the dup'ed key strings after + notifying the registry; fixes another leak. + + * registryd/registry.c: + (registry_flush_event_queue): Free the CORBA_any when + flushing the event, not just the string. Fixes another leak. + (registry_queue_event): Free the CORBA_any when dropping + events on the floor; fixes another leak. + + * libspi/util.c: + (spi_init_any_object, spi_init_any_nil): + Always set _release to TRUE. Fixes another leak. + +2006-02-20 Bill Haneman + * configure.in: Rev to 1.7.5. Reinstate localization of this module. Thanks for Rodney Dawes for fixing my patch. diff --git a/atk-bridge/bridge.c b/atk-bridge/bridge.c index 7098dd9..a56aa9b 100644 --- a/atk-bridge/bridge.c +++ b/atk-bridge/bridge.c @@ -693,6 +693,8 @@ spi_atk_emit_eventv (const GObject *gobject, CORBA_exception_free (&ev); g_free (e.type); + + if (e.any_data._release) CORBA_free (&e.any_data._value); va_end (args); @@ -952,6 +954,8 @@ spi_atk_bridge_key_listener (AtkKeyEventStruct *event, gpointer data) result = Accessibility_DeviceEventController_notifyListenersSync ( spi_atk_bridget_get_dec (), &key_event, &ev); + if (key_event.event_string) CORBA_free (key_event.event_string); + if (BONOBO_EX(&ev)) { result = FALSE; CORBA_exception_free (&ev); @@ -1080,10 +1084,8 @@ spi_atk_bridge_signal_listener (GSignalInvocationHint *signal_hint, spi_atk_emit_eventv (gobject, detail1, detail2, &any, "object:%s", name); - if (sp) + if (sp) g_free (sp); - if (any._release) - CORBA_free (any._value); return TRUE; } @@ -1173,7 +1175,7 @@ spi_atk_bridge_init_base (CORBA_any *any, AtkObject *obj, const gchar *s = atk_object_get_name (obj); *app = spi_accessible_new_return (atk_get_root (), FALSE, NULL); *role = spi_role_from_atk_role (atk_object_get_role (obj)); - *name = CORBA_string_dup (s ? s : ""); + *name = s ? s : ""; /* string gets dup-ed in util.c spi_init_any_* */ } static void diff --git a/configure.in b/configure.in index 5b74e3c..f957ddb 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ AC_INIT(idl/Accessibility.idl) AT_SPI_MAJOR_VERSION=1 AT_SPI_MINOR_VERSION=7 -AT_SPI_MICRO_VERSION=5 +AT_SPI_MICRO_VERSION=6 AT_SPI_INTERFACE_AGE=0 AT_SPI_BINARY_AGE=0 AT_SPI_VERSION="$AT_SPI_MAJOR_VERSION.$AT_SPI_MINOR_VERSION.$AT_SPI_MICRO_VERSION" diff --git a/libspi/util.c b/libspi/util.c index 6c254ef..c28ed8f 100644 --- a/libspi/util.c +++ b/libspi/util.c @@ -130,7 +130,7 @@ spi_init_any_nil (CORBA_any *any_details, details->any_data._type = TC_null; details->any_data._value = NULL; - details->any_data._release = FALSE; + details->any_data._release = TRUE; } void @@ -151,7 +151,7 @@ spi_init_any_object (CORBA_any *any_details, Accessibility_Application app, details->any_data._type = TC_CORBA_Object; details->any_data._value = o; - details->any_data._release = FALSE; + details->any_data._release = TRUE; } void diff --git a/registryd/registry.c b/registryd/registry.c index 9ec4dcc..0dab16a 100644 --- a/registryd/registry.c +++ b/registryd/registry.c @@ -718,6 +718,8 @@ registry_flush_event_queue (SpiRegistry *registry, } CORBA_free ((void *)q_ctx->etype.event_name); CORBA_free ((void *)q_ctx->e_out.type); + if (q_ctx->e_out.any_data._type != TC_null) + CORBA_free ((void *)q_ctx->e_out.any_data._value); g_free (q_ctx); } registry->is_queueing = FALSE; @@ -848,6 +850,8 @@ registry_queue_event (SpiRegistry *registry, NotifyContext *ctx) bonobo_object_release_unref (q_ctx->source, NULL); CORBA_free ((void *)q_ctx->etype.event_name); CORBA_free ((void *)q_ctx->e_out.type); + if (q_ctx->e_out.any_data._type != TC_null) + CORBA_free ((void *)q_ctx->e_out.any_data._value); g_free (q_ctx); return TRUE; } -- 2.7.4