Fix: Invalid Memory Access issues 54/224354/1
authorDewal Agarwal <d1.agarwal@samsung.com>
Thu, 6 Feb 2020 12:24:41 +0000 (17:54 +0530)
committerAbhishek Vijay <abhishek.v@samsung.com>
Mon, 10 Feb 2020 05:24:58 +0000 (05:24 +0000)
Change-Id: Id591606bf573c113695097636648cf95e8df37b1
Signed-off-by: Dewal Agarwal <d1.agarwal@samsung.com>
(cherry picked from commit 6c89017897d35124ee4886998d4dd7e31fb59a6d)

src/bm_power_engine.c
src/bm_util.c

index 6768043..9344d28 100644 (file)
@@ -314,8 +314,6 @@ static int bm_appid_session_usage_map(char *app_id, int app_usage, bm_plugin_id_
 #endif /* DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN */
 
                _DBG("update - app_usage for app_id(%s), for resource(%d), by usage(%d)", app_id, resource_id, app_usage);
-
-               _INFO("updated - %d", g_hash_table_replace(gl_hash, app_id, temp));
        } else {
                appid_usage_s *temp = (appid_usage_s *)calloc(1, sizeof(appid_usage_s));
                if (temp == NULL) {
@@ -1497,7 +1495,7 @@ int bm_get_data_from_handles(void)
        int ret_val = BATTERY_MONITOR_ERROR_NONE;
        bool mode = false;
 
-       gl_hash = g_hash_table_new_full(g_str_hash, g_str_equal, bm_data_free, NULL);
+       gl_hash = g_hash_table_new_full(g_str_hash, g_str_equal, bm_data_free, g_free);
        if (!gl_hash)
                _ERR("Global Hash creation failed");
 
index 39b668b..d83397d 100644 (file)
@@ -332,8 +332,6 @@ void bm_atm_st1_free(gpointer data)
 
        app_time_map_st1 *node = (app_time_map_st1 *)data;
 
-       _DBG("delete - app_id(%s) app_time_map_st1", node->app_id);
-
        BM_FREE(node);
 
        EXIT;
@@ -351,8 +349,6 @@ void bm_atm_st2_free(gpointer data)
 
        app_time_map_st2 *node = (app_time_map_st2 *)data;
 
-       _DBG("delete - app_id(%s) of app_time_map_st2", node->app_id);
-
        BM_FREE(node);
 
        EXIT;