Fix memory leak in storage API 60/100560/5 accepted/tizen/common/20161214.160735 accepted/tizen/ivi/20161214.085606 accepted/tizen/mobile/20161214.085323 accepted/tizen/tv/20161214.085439 accepted/tizen/unified/20170309.033959 accepted/tizen/wearable/20161214.085452 submit/tizen/20161214.021341 submit/tizen_unified/20170308.100409
authorSuresh Kumar N <suresh.n@samsung.com>
Mon, 28 Nov 2016 11:33:49 +0000 (17:03 +0530)
committerSuresh Kumar N <suresh.n@samsung.com>
Mon, 12 Dec 2016 08:03:23 +0000 (13:33 +0530)
Change-Id: I8cf39a3c0879297f778908442ee2b7383d2ce649
Signed-off-by: Suresh Kumar N <suresh.n@samsung.com>
packaging/tel-plugin-database.spec
src/database_main.c

index 5ae2357..395d212 100644 (file)
@@ -1,6 +1,6 @@
 %define major 0
 %define minor 1
-%define patchlevel 29
+%define patchlevel 30
 
 Name:           tel-plugin-database
 Version:        %{major}.%{minor}.%{patchlevel}
index fe328b1..24ce10f 100644 (file)
@@ -187,16 +187,34 @@ static gboolean _read_query_database_internal(Storage *strg, void *handle, const
 }
 
 static gboolean read_query_database(Storage *strg, void *handle, const char *query, GHashTable *in_param,
-               GHashTable *out_param, int out_param_cnt)
+               GHashTable **out_param, int out_param_cnt)
 {
-       _read_query_database_internal(strg, handle, query, in_param, out_param, out_param_cnt, FALSE);
+       GHashTable *out_hash_table;
+
+       if (out_param == NULL)
+               return FALSE;
+
+       out_hash_table = g_hash_table_new_full(g_str_hash, g_str_equal,
+                       g_free, (GDestroyNotify)g_hash_table_destroy);
+
+       if (_read_query_database_internal(strg,
+                       handle, query, in_param, out_hash_table, out_param_cnt, FALSE) == FALSE) {
+               g_hash_table_destroy(out_hash_table);
+               return FALSE;
+       }
+
+       *out_param = out_hash_table;
+
        return TRUE;
 }
 
 static gboolean read_query_database_in_order(Storage *strg, void *handle, const char *query, GHashTable *in_param,
                GSList **out_param, int out_param_cnt)
 {
-       _read_query_database_internal(strg, handle, query, in_param, out_param, out_param_cnt, TRUE);
+       if (_read_query_database_internal(strg,
+                       handle, query, in_param, out_param, out_param_cnt, TRUE) == FALSE)
+               return FALSE;
+
        return TRUE;
 }