From: Jaehyun Kim Date: Mon, 22 Jun 2020 06:34:16 +0000 (+0900) Subject: Fix memory leak in stc_plugin_monitor_initialize X-Git-Tag: submit/tizen/20200623.015427^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee2840c9abe00ab42f19e32024c19c7809d4e30c;p=platform%2Fcore%2Fconnectivity%2Fstc-manager.git Fix memory leak in stc_plugin_monitor_initialize Variable system going out of scope leaks the memory it points to. Change-Id: I9d2c5dc3cc3b951954e793cf3864f270810d846c Signed-off-by: Jaehyun Kim --- diff --git a/plugin/monitor/stc-plugin-monitor.c b/plugin/monitor/stc-plugin-monitor.c index a26749f..7922b88 100755 --- a/plugin/monitor/stc-plugin-monitor.c +++ b/plugin/monitor/stc-plugin-monitor.c @@ -343,15 +343,15 @@ stc_error_e stc_plugin_monitor_initialize(stc_manager_stop_cb stop_cb) { __STC_LOG_FUNC_ENTER__; + ret_value_msg_if(stop_cb == NULL, STC_ERROR_INVALID_PARAMETER, + "stop_cb callback is NULL"); + stc_system_s *system = MALLOC0(stc_system_s, 1); GIOChannel *gio = NULL; ret_value_msg_if(system == NULL, STC_ERROR_OUT_OF_MEMORY, "stc_system_s malloc fail!"); - ret_value_msg_if(stop_cb == NULL, STC_ERROR_INVALID_PARAMETER, - "stop_cb callback is NULL"); - g_stop_cb = stop_cb; /* initializing current classid */