Re: [PATCH 4/4] rt-tests: deadline_test: add missing frees

John Kacur
2019-04-05T14:36:23Z

> The threads and thread data structures are allocated using calloc(). But never
> free'd. So, free them.
>
> While here, remove the if statement for setcpu_buf. Free() is NULL safe.
>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> ---
> src/sched_deadline/deadline_test.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
> index 4826557d0624..69e6fd18b73b 100644
> --- a/src/sched_deadline/deadline_test.c
> +++ b/src/sched_deadline/deadline_test.c
> @@ -2092,8 +2092,9 @@ int main (int argc, char **argv)
> printf("\n");
> }
>
> - if (!setcpu_buf)
> - free(setcpu_buf);
> + free(thread);
> + free(sched_data);
> + free(setcpu_buf);
>
> return 0;
> }
> --
> 2.11.0
>
>
Signed-off-by: John Kacur <jkacur@redhat.com>