From: SangYoun Kwak Date: Thu, 20 Jan 2022 05:51:28 +0000 (+0900) Subject: Close the sqlite handle 'db' and free memories X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_6.5;p=platform%2Fcore%2Fsystem%2Fbatterymonitor-plugins.git Close the sqlite handle 'db' and free memories Change-Id: I9588b61b2a18475c53fff16037114f1b8e16d1c4 Signed-off-by: SangYoun Kwak (cherry picked from commit 2c21c8678d528240097017d760d441ed783e0337) --- diff --git a/plugin/cpu/src/bm_cpu_plugin.c b/plugin/cpu/src/bm_cpu_plugin.c index 285b051..1b6638a 100644 --- a/plugin/cpu/src/bm_cpu_plugin.c +++ b/plugin/cpu/src/bm_cpu_plugin.c @@ -302,6 +302,8 @@ int get_feature_data(bm_data_h *handle, bm_plugin_data_type_e type) if (!usage_head) { _E("calloc failed"); + sqlite3_close(db); + EXIT; return BM_PLUGIN_ERROR_OUT_OF_MEMORY; } @@ -311,6 +313,9 @@ int get_feature_data(bm_data_h *handle, bm_plugin_data_type_e type) if (!usage) { _E("calloc failed"); + free(usage_head); + sqlite3_close(db); + EXIT; return BM_PLUGIN_ERROR_OUT_OF_MEMORY; }