[PATCH 3/6] tests/qtest/bios-tables-test: Free tables at dump_aml_files

Fabiano Rosas posted 6 patches 5 months ago
[PATCH 3/6] tests/qtest/bios-tables-test: Free tables at dump_aml_files
Posted by Fabiano Rosas 5 months ago
The dump_aml_files() function calls load_expected_aml() to allocate
the tables but never frees it. Add the missing call to
free_test_data().

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/bios-tables-test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 16d0ffbdf6..1cf4e3f7ef 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -292,6 +292,7 @@ static void dump_aml_files(test_data *data, bool rebuild)
 
         g_free(aml_file);
     }
+    free_test_data(&exp_data);
 }
 
 static bool create_tmp_asl(AcpiSdtTable *sdt)
-- 
2.35.3
Re: [PATCH 3/6] tests/qtest/bios-tables-test: Free tables at dump_aml_files
Posted by Philippe Mathieu-Daudé 5 months ago
On 9/12/24 21:44, Fabiano Rosas wrote:
> The dump_aml_files() function calls load_expected_aml() to allocate
> the tables but never frees it. Add the missing call to
> free_test_data().
> 

This is also Coverity CID 1549449 (RESOURCE_LEAK)

> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/bios-tables-test.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 16d0ffbdf6..1cf4e3f7ef 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -292,6 +292,7 @@ static void dump_aml_files(test_data *data, bool rebuild)
>   
>           g_free(aml_file);
>       }
> +    free_test_data(&exp_data);
>   }
>   
>   static bool create_tmp_asl(AcpiSdtTable *sdt)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>