[libgda] Fix memory and resource leaks spotted by cppcheck tool
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Fix memory and resource leaks spotted by cppcheck tool
- Date: Wed, 13 Oct 2010 15:22:39 +0000 (UTC)
commit 54f0e18fe61d5d01405c6a274c85f4e023e2af06
Author: David King <davidk openismus com>
Date: Wed Oct 13 11:40:20 2010 +0200
Fix memory and resource leaks spotted by cppcheck tool
libgda-ui/gdaui-basic-form.c | 1 -
libgda/gda-connection.c | 1 +
libgda/gda-data-model.c | 1 +
libgda/gda-util.c | 2 ++
libgda/sqlite/gen_emb_string.c | 2 ++
tests/meta-store/common.c | 1 +
6 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/libgda-ui/gdaui-basic-form.c b/libgda-ui/gdaui-basic-form.c
index a98637c..3a30d42 100644
--- a/libgda-ui/gdaui-basic-form.c
+++ b/libgda-ui/gdaui-basic-form.c
@@ -727,7 +727,6 @@ create_text_label_for_sentry (SingleEntry *sentry, gchar **out_title)
}
else {
- gchar *label;
GSList *params;
gchar *title = NULL;
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 7a5fbce..c412859 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -1200,6 +1200,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-data-model.c b/libgda/gda-data-model.c
index 0533888..3619c78 100644
--- a/libgda/gda-data-model.c
+++ b/libgda/gda-data-model.c
@@ -1155,6 +1155,7 @@ gda_data_model_export_to_string (GdaDataModel *model, GdaDataModelIOFormat forma
g_string_append_c (retstring, quote);
}
g_string_append_c (retstring, '\n');
+ g_free (rcols);
}
}
else
diff --git a/libgda/gda-util.c b/libgda/gda-util.c
index 8235de2..a8cf6f4 100644
--- a/libgda/gda-util.c
+++ b/libgda/gda-util.c
@@ -1109,6 +1109,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 1b9ecda..16e885f 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]