Fix some memory leaks 84/268684/1 accepted/tizen/unified/20211231.161332 submit/tizen/20211230.110505
authorMateusz Majewski <m.majewski2@samsung.com>
Wed, 29 Dec 2021 13:14:42 +0000 (14:14 +0100)
committerMateusz Majewski <m.majewski2@samsung.com>
Wed, 29 Dec 2021 13:16:28 +0000 (14:16 +0100)
Issues reported by jm0508.kwon@samsung.com and
ravi.singh1@samsung.com. Thanks!

Change-Id: I9658a23bf9f0960f8b29167c0a28b80c995b706f
Co-authored-by: Ravi Singh <ravi.singh1@samsung.com>
src/process/proc-usage-stats-helper.c
src/process/proc-usage-stats.c

index 2f44338..5e3ac6d 100644 (file)
@@ -240,6 +240,8 @@ void proc_free_runtime_info_task(struct runtime_info_task *rt_task)
        if (rt_task->pipe_fds[1] >= 0)
                close(rt_task->pipe_fds[1]);
 
+       free(rt_task->pid_list);
+
        // we assume that rt_task->task_invocation is already freed before calling proc_free_runtime_info_task.
 
        free(rt_task);
index d4cb9e8..49c6799 100644 (file)
@@ -261,6 +261,8 @@ void proc_runtime_info_request_handler(GDBusMethodInvocation *invocation,
        while (g_variant_iter_loop(iter, "i", &tmp))
                rt_task->pid_list[i++] = tmp;
 
+       g_variant_iter_free(iter);
+
        if (rt_task->task_type == RUNTIME_INFO_TASK_MEMORY)
                rt_task->usage_info_list = (void *)malloc(sizeof(struct process_memory_info_s) * rt_task->task_size);
        else if (rt_task->task_type == RUNTIME_INFO_TASK_CPU)