Fix memory leak in storage API 32/104632/1 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable tizen_3.0.m2 tizen_3.0_tv accepted/tizen/3.0.m2/mobile/20170104.141749 accepted/tizen/3.0.m2/tv/20170104.142132 accepted/tizen/3.0.m2/wearable/20170104.142425 accepted/tizen/3.0/common/20161215.162342 accepted/tizen/3.0/ivi/20161215.042937 accepted/tizen/3.0/mobile/20161215.042751 accepted/tizen/3.0/tv/20161215.042906 accepted/tizen/3.0/wearable/20161215.042915 submit/tizen_3.0.m2/20170104.093751 submit/tizen_3.0/20161214.021739
authorSuresh Kumar N <suresh.n@samsung.com>
Mon, 28 Nov 2016 11:33:49 +0000 (17:03 +0530)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 14 Dec 2016 02:06:34 +0000 (11:06 +0900)
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;
 }