From 4b2b6620809edd8443d347dfb13251711e5e84ec Mon Sep 17 00:00:00 2001 From: Kichan Kwon Date: Wed, 29 Apr 2020 12:15:35 +0900 Subject: [PATCH] Fix memory leak Change-Id: Icc17a110af79c93197cdcc97933ec2f033db9f96 Signed-off-by: Kichan Kwon --- src/client-api/dumpsys-system.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client-api/dumpsys-system.c b/src/client-api/dumpsys-system.c index 6aaa013..ee8b18e 100644 --- a/src/client-api/dumpsys-system.c +++ b/src/client-api/dumpsys-system.c @@ -90,6 +90,8 @@ static void dump_thread_cb(GTask *task, gpointer source_object, gpointer task_da int result = dump_cb(dump_data->fd, dump_data->argc, dump_data->argv); close(dump_data->fd); + if (dump_data->argv) + free(dump_data->argv); free(dump_data); g_task_return_int(task, result); } @@ -305,6 +307,10 @@ int API_FUNCTION dumpsys_system_unregister_dump_cb(void *handler) } dump_cb = NULL; - service_name = NULL; + + if (service_name) { + free(service_name); + service_name = NULL; + } return dbus_close() ? TIZEN_ERROR_NONE : TIZEN_ERROR_IO_ERROR; } -- 2.7.4