From 4ac7e09a1d49b62d4aa7658dc949f59d4866847f Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 18 Mar 2019 10:20:13 +0900 Subject: [PATCH] Fix memory leak issue Dynamic memory referenced by 'handle->auth_info_cb' was allocated at autofill_service_stub.c:4040 by calling function 'rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_clone' at autofill_service.c:288 and lost at autofill_service.c:311. Dynamic memory referenced by 'handle->fill_response_received_cb' was allocated at autofill_service_stub.c:4188 by calling function 'rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_clone' at autofill_service.c:296 and lost at autofill_service.c:311. Change-Id: Iede991ba41e6fd24de1297dadd1335f8e6a97977 Signed-off-by: Jihoon Kim --- service_lib/autofill_service.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/service_lib/autofill_service.c b/service_lib/autofill_service.c index 8113909..c8631bc 100644 --- a/service_lib/autofill_service.c +++ b/service_lib/autofill_service.c @@ -307,6 +307,8 @@ static autofill_svc_s *__create_client(const char *app_id, if (!handle->send_error_cb) { LOGE("Out of memory"); free(handle->app_id); + rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_destroy(handle->auth_info_cb); + rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_destroy(handle->fill_response_received_cb); free(handle); return NULL; } @@ -322,17 +324,25 @@ static void __destroy_client(gpointer data) if (!handle) return; - if (handle->auth_info_cb) + if (handle->auth_info_cb) { rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_destroy(handle->auth_info_cb); + handle->auth_info_cb = NULL; + } - if (handle->fill_response_received_cb) + if (handle->fill_response_received_cb) { rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_destroy(handle->fill_response_received_cb); + handle->fill_response_received_cb = NULL; + } - if (handle->send_error_cb) + if (handle->send_error_cb) { rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_destroy(handle->send_error_cb); + handle->send_error_cb = NULL; + } - if (handle->app_id) + if (handle->app_id) { free(handle->app_id); + handle->app_id = NULL; + } free(handle); } -- 2.34.1