[PATCH i-g-t v2 5/7] runner: Free settings at the end

Gustavo Sousa gustavo.sousa at intel.com
Wed Jan 22 11:46:33 UTC 2025


Quoting Lucas De Marchi (2025-01-21 19:57:31-03:00)
>Keep valgrind happy with the normal allocations so we can find the real
>leaks. Avoid this kind of leak:
>
>        ==806592== 8 bytes in 1 blocks are definitely lost in loss record 46 of 188
>        ==806592==    at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
>        ==806592==    by 0x4BD534E: strdup (strdup.c:42)
>        ==806592==    by 0x10E6AA: parse_options (settings.c:863)
>        ==806592==    by 0x10D2DD: main (runner.c:19)
>
>Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

This looks correct, so:

Reviewed-by: Gustavo Sousa <gustavo.sousa at intel.com>

, but it seems we also need to make initialize_execute_state() and
initialize_execute_state_from_resume() properly clear_settings() when
things go wrong internally.

--
Gustavo Sousa

>---
> runner/resume.c | 2 ++
> runner/runner.c | 2 ++
> 2 files changed, 4 insertions(+)
>
>diff --git a/runner/resume.c b/runner/resume.c
>index 0f4e42bfa..ed17351c6 100644
>--- a/runner/resume.c
>+++ b/runner/resume.c
>@@ -55,6 +55,8 @@ int main(int argc, char **argv)
>                 exitcode = 3;
>         }
> 
>+        clear_settings(&settings);
>+
>         printf("Done.\n");
>         return exitcode;
> }
>diff --git a/runner/runner.c b/runner/runner.c
>index 4855ad641..258b30b36 100644
>--- a/runner/runner.c
>+++ b/runner/runner.c
>@@ -49,6 +49,8 @@ int main(int argc, char **argv)
>                 exitcode = 1;
>         }
> 
>+        clear_settings(&settings);
>+
>         printf("Done.\n");
>         return exitcode;
> }
>-- 
>2.48.0
>


More information about the igt-dev mailing list