Fix memory leak 82/232182/1
authorKichan Kwon <k_c.kwon@samsung.com>
Wed, 29 Apr 2020 03:15:35 +0000 (12:15 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 29 Apr 2020 03:27:24 +0000 (12:27 +0900)
Change-Id: Icc17a110af79c93197cdcc97933ec2f033db9f96
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/client-api/dumpsys-system.c

index 6aaa013..ee8b18e 100644 (file)
@@ -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;
 }