fixed memory leaks
authorImran Zaman <imran.zaman@linux.intel.com>
Fri, 17 May 2013 16:35:37 +0000 (19:35 +0300)
committerJussi Laako <jussi.laako@linux.intel.com>
Thu, 23 May 2013 10:50:33 +0000 (13:50 +0300)
src/common/db/gsignond-db-secret-database.c
src/plugins/ssotest/gsignond-ssotest-plugin.c
test/db/dbtest.c

index 69b3c16..120d05d 100644 (file)
@@ -82,7 +82,7 @@ _gsignond_db_read_key_value (
 {
     gchar *key = NULL;
     GVariant *value = NULL;
-    key = g_strdup ((const gchar *)sqlite3_column_text (stmt, 0));
+    key = (const gchar *)sqlite3_column_text (stmt, 0);
     value = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, 
         (gconstpointer) sqlite3_column_blob(stmt, 1),
         (gsize) sqlite3_column_bytes(stmt, 1), sizeof(guchar));
index 9162f7f..e0c7e99 100644 (file)
@@ -67,6 +67,7 @@ static void gsignond_ssotest_plugin_request_initial (
     GSignondPlugin *plugin, GSignondSessionData *session_data, 
     const gchar *mechanism)
 {
+    gint i;
     GSignondSsoTestPlugin *self = GSIGNOND_SSOTEST_PLUGIN (plugin);
 
     self->priv->is_canceled = FALSE;
@@ -75,12 +76,11 @@ static void gsignond_ssotest_plugin_request_initial (
     DBG ("response=%p", response);
     gsignond_session_data_set_realm (response, "testRealm_after_test");
 
-    int i;
+    gsignond_plugin_status_changed (GSIGNOND_PLUGIN (self),
+                                    GSIGNOND_PLUGIN_STATE_WAITING,
+                                    "hello from the test plugin");
     for (i = 0; i < 10; i++) {
         if (!self->priv->is_canceled) {
-            gsignond_plugin_status_changed (GSIGNOND_PLUGIN (self),
-                                            GSIGNOND_PLUGIN_STATE_WAITING,
-                                            "hello from the test plugin");
             g_usleep (1000 * 1000 / 100);
             g_main_context_iteration (NULL, FALSE);
         }
index 59c568c..4342985 100644 (file)
@@ -487,7 +487,7 @@ START_TEST (test_secret_database)
     g_hash_table_foreach (data2, (GHFunc)_compare_key_value, &input);
     fail_if (input.status != 1);
 
-    g_hash_table_unref(data2);
+    gsignond_dictionary_unref (data2);
     g_hash_table_unref(data);
 
 
@@ -678,7 +678,7 @@ START_TEST (test_secret_storage)
     g_hash_table_foreach (data2, (GHFunc)_compare_key_value, &input);
     fail_if (input.status != 1);
 
-    g_hash_table_unref(data2);
+    gsignond_dictionary_unref(data2);
     g_hash_table_unref(data);
 
     fail_unless (gsignond_secret_storage_remove_data (
@@ -957,7 +957,7 @@ START_TEST (test_credentials_database)
     input.status = 1;
     g_hash_table_foreach (data2, (GHFunc)_compare_key_value, &input);
     fail_if (input.status != 1);
-    g_hash_table_unref(data2);
+    gsignond_dictionary_unref(data2);
     g_hash_table_unref(data);
 
     fail_unless (gsignond_db_credentials_database_remove_data (