Another memleak patch



I found another similar leak, patch attached.

//andersca
andersca gnu org
? po/ChangeLog.unpatched
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v
retrieving revision 1.1103
diff -u -r1.1103 ChangeLog
--- ChangeLog	2001/08/22 21:11:57	1.1103
+++ ChangeLog	2001/08/22 21:52:30
@@ -2,6 +2,7 @@
 
 	* bonobo/bonobo-ui-component.c (impl_xml_get): 
 	Call CORBA_exception_free on our ev.
+	(impl_get_prop): Likewise.
 
 2001-08-21  Alex Larsson  <alexl redhat com>
 
Index: bonobo/bonobo-ui-component.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-component.c,v
retrieving revision 1.50
diff -u -r1.50 bonobo-ui-component.c
--- bonobo/bonobo-ui-component.c	2001/08/22 21:19:12	1.50
+++ bonobo/bonobo-ui-component.c	2001/08/22 21:52:31
@@ -1188,7 +1188,7 @@
 	char *full_path;
 	xmlChar *ans;
 	gchar   *ret;
-        CORBA_Environment hack_ev;
+        CORBA_Environment *real_ev, tmp_ev;
 
 	g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component), NULL);
 
@@ -1199,13 +1199,15 @@
 
 	bonobo_object_ref (BONOBO_OBJECT (component));
 
-	if (!opt_ev) {
+	if (opt_ev)
+		real_ev = opt_ev;
+	else {
 		/* Hack to avoid warnings for reading non-existant properties */
-		CORBA_exception_init (&hack_ev);
-		opt_ev = &hack_ev;
+		CORBA_exception_init (&tmp_ev);
+		real_ev = &tmp_ev;
 	}
 
-	ans = bonobo_ui_component_get (component, full_path, FALSE, opt_ev);
+	ans = bonobo_ui_component_get (component, full_path, FALSE, real_ev);
 
 	if (ans) {
 		ret = g_strdup (ans);
@@ -1214,6 +1216,9 @@
 		ret = NULL;
 
 	bonobo_object_unref (BONOBO_OBJECT (component));
+
+	if (!opt_ev)
+		CORBA_exception_free (&tmp_ev);
 	
 	return ret;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]