libgda r3109 - in trunk: . providers/postgres



Author: murrayc
Date: Thu Apr  3 20:43:26 2008
New Revision: 3109
URL: http://svn.gnome.org/viewvc/libgda?rev=3109&view=rev

Log:
2008-04-03  Murray Cumming  <murrayc murrayc com>

* providers/postgres/gda-postgres-provider.c
  (get_connection_type_list): g_strdup() the initial value of 
any_type_oid to avoid possibly freeing a static string.
* providers/postgres/libmain.c (plugin_init): Add a comment that the 
module path is leaked, but that it is not a big deal.

Modified:
   trunk/ChangeLog
   trunk/providers/postgres/gda-postgres-provider.c
   trunk/providers/postgres/libmain.c

Modified: trunk/providers/postgres/gda-postgres-provider.c
==============================================================================
--- trunk/providers/postgres/gda-postgres-provider.c	(original)
+++ trunk/providers/postgres/gda-postgres-provider.c	Thu Apr  3 20:43:26 2008
@@ -505,10 +505,12 @@
 	g_string_free (string, FALSE);
 
 	/* make a string of the oid of type 'any' */
-	cdata->any_type_oid = "";
+	cdata->any_type_oid = g_strdup("");
 	if (pg_res_anyoid) {
-		if (PQntuples (pg_res_anyoid) == 1) 
+		if (PQntuples (pg_res_anyoid) == 1) {
+			g_free(cdata->any_type_oid);
 			cdata->any_type_oid = g_strdup (PQgetvalue (pg_res_anyoid, 0, 0));
+		}
 		PQclear (pg_res_anyoid);
 	}
 	return 0;

Modified: trunk/providers/postgres/libmain.c
==============================================================================
--- trunk/providers/postgres/libmain.c	(original)
+++ trunk/providers/postgres/libmain.c	Thu Apr  3 20:43:26 2008
@@ -34,6 +34,8 @@
 void
 plugin_init (const gchar *real_path)
 {
+	/* This is never freed, but that is OK. It is only called once. */
+	/* But it would be nice to have some cleanup function just to shut valgrind up. murrayc. */
         if (real_path)
                 module_path = g_strdup (real_path);
 }



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