[libgda/LIBGDA_4.0] Fix memory and resource leaks spotted by cppcheck tool



commit 2c5a8fb569b51c82b881f88617d4b9ca972bc6a7
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun Nov 28 12:02:15 2010 +0100

    Fix memory and resource leaks spotted by cppcheck tool

 libgda/gda-connection.c        |    1 +
 libgda/gda-util.c              |    2 ++
 libgda/sqlite/gen_emb_string.c |    2 ++
 tests/meta-store/common.c      |    1 +
 4 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index f95119b..b110d2f 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -860,6 +860,7 @@ gda_connection_open_from_string (const gchar *provider_name, const gchar *cnc_st
 		}
 	}	
 
+	g_free (real_auth_string);
 	g_free (real_cnc);
 	g_free (user);
 	g_free (pass);
diff --git a/libgda/gda-util.c b/libgda/gda-util.c
index eaad030..db82179 100644
--- a/libgda/gda-util.c
+++ b/libgda/gda-util.c
@@ -1092,6 +1092,8 @@ gda_compute_dml_statements (GdaConnection *cnc, GdaStatement *select_stmt, gbool
 			expr->param_spec = pspec;
 			ust->expr_list = g_slist_append (ust->expr_list, expr);
 		}
+
+		g_free (str);
 	}
 	g_hash_table_destroy (fields_hash);
 
diff --git a/libgda/sqlite/gen_emb_string.c b/libgda/sqlite/gen_emb_string.c
index b4f26f8..12f0af8 100644
--- a/libgda/sqlite/gen_emb_string.c
+++ b/libgda/sqlite/gen_emb_string.c
@@ -101,6 +101,7 @@ main (int argc,char** argv)
 		rewind (file);
 		if (fsize + buffer_index >= maxlen) {
 			fprintf (stderr, "Max buffer size reached\nIncrease MAXSIZE constant and re-run\n");
+			fclose (file);
 			return 1;
 		}
 		
@@ -108,6 +109,7 @@ main (int argc,char** argv)
 		n_read = fread (buffer + buffer_index, 1, fsize, file);
 		if (n_read != fsize) {
 			fprintf (stderr, "Reading error");
+			fclose (file);
 			return 1;
 		}
 
diff --git a/tests/meta-store/common.c b/tests/meta-store/common.c
index ac10ae5..dd8c14f 100644
--- a/tests/meta-store/common.c
+++ b/tests/meta-store/common.c
@@ -108,6 +108,7 @@ meta_changed_cb (GdaMetaStore *store, GSList *changes, gpointer data)
 	}
 	if (expected_changes) {
 		/* expected more changes */
+		el = expected_changes;
 		gchar *estr = (gchar *) el->data;
 		g_print ("Received no change but EXPECTED GdaMetaStoreChange: %s", estr);
 		exit (EXIT_FAILURE);



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