From: Jihoon Kim Date: Mon, 21 Jan 2019 10:21:32 +0000 (+0900) Subject: Fix memory leak X-Git-Tag: submit/tizen/20190122.093052~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F42%2F198142%2F1;p=platform%2Fcore%2Fuifw%2Fautofill-daemon.git Fix memory leak Change-Id: Ib930c35f9455682056b17b49d6709bb6dbf071e1 Signed-off-by: Jihoon Kim --- diff --git a/src/autofill-daemon.c b/src/autofill-daemon.c index 6bfb347..55e8298 100644 --- a/src/autofill-daemon.c +++ b/src/autofill-daemon.c @@ -29,6 +29,8 @@ #include "autofill_config.h" static rpc_port_proxy_AutofillSvcPort_h svc_rpc_h = NULL; +static rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_received_cb_h = NULL; +static rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb_h = NULL; static int connect_service(); @@ -585,8 +587,16 @@ static void __on_connected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) { LOGI("[__RPC_PORT__] connected"); - rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_received_cb_h = rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_create(__fill_response_recv_cb, false, NULL); - rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb_h = rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_create(__auth_info_recv_cb, false, NULL); + if (fill_response_received_cb_h) { + free(fill_response_received_cb_h); + } + + if (auth_info_cb_h) { + free(auth_info_cb_h); + } + + fill_response_received_cb_h = rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_create(__fill_response_recv_cb, false, NULL); + auth_info_cb_h = rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_create(__auth_info_recv_cb, false, NULL); int r = rpc_port_proxy_AutofillSvcPort_invoke_Register(h, auth_info_cb_h, fill_response_received_cb_h); if (r != 0) @@ -599,6 +609,16 @@ static void __on_disconnected(rpc_port_proxy_AutofillSvcPort_h h, void *user_dat LOGD("disconnected"); svc_rpc_h = NULL; + + if (fill_response_received_cb_h) { + free(fill_response_received_cb_h); + fill_response_received_cb_h = NULL; + } + + if (auth_info_cb_h) { + free(auth_info_cb_h); + auth_info_cb_h = NULL; + } } static void __on_rejected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data)