libgda r3078 - in branches/release-3-0-branch: . libgda



Author: murrayc
Date: Fri Mar 14 09:52:18 2008
New Revision: 3078
URL: http://svn.gnome.org/viewvc/libgda?rev=3078&view=rev

Log:
2008-03-14  Joel Pfaff  <joel pfaff gmail com>

Bug 507698 â Memory leaks in GdaProviderInfo handling.

* libgda/gda-client.c (find_or_load_provider):
* libgda/gda-config.c (gda_config_get_provider_by_name):
Call gda_provider_info_free() to prevent leaks.

Modified:
   branches/release-3-0-branch/ChangeLog
   branches/release-3-0-branch/libgda/gda-client.c
   branches/release-3-0-branch/libgda/gda-config.c

Modified: branches/release-3-0-branch/libgda/gda-client.c
==============================================================================
--- branches/release-3-0-branch/libgda/gda-client.c	(original)
+++ branches/release-3-0-branch/libgda/gda-client.c	Fri Mar 14 09:52:18 2008
@@ -290,6 +290,7 @@
 
 	if (!prv->handle) {
 		emit_client_error (client, NULL, g_module_error ());
+		gda_provider_info_free(prv_info);
 		g_free (prv);
 		return NULL;
 	}
@@ -305,6 +306,8 @@
 		g_free (dirname);
 	}
 
+	gda_provider_info_free(prv_info);
+
 	g_module_symbol (prv->handle, "plugin_get_name",
 			 (gpointer) &prv->plugin_get_name);
 	g_module_symbol (prv->handle, "plugin_get_description",

Modified: branches/release-3-0-branch/libgda/gda-config.c
==============================================================================
--- branches/release-3-0-branch/libgda/gda-config.c	(original)
+++ branches/release-3-0-branch/libgda/gda-config.c	Fri Mar 14 09:52:18 2008
@@ -1616,6 +1616,8 @@
 	GList *l;
 	const gchar *tmpname;
 
+	GdaProviderInfo * info = NULL;
+
 	if (name)
 		tmpname = name;
 	else
@@ -1627,10 +1629,14 @@
 		GdaProviderInfo *provider_info = (GdaProviderInfo *) l->data;
 
 		if (provider_info && !strcmp (provider_info->id, tmpname))
-			return provider_info;
+		{
+			info = gda_provider_info_copy(provider_info);
+		}
 	}
 
-	return NULL;
+	gda_config_free_provider_list(prov_list);
+
+	return info;
 }
 
 /**



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