Hi Matheus

On 2025-05-26 10:20, Matheus Tavares Bernardino wrote:
> The test fails with --enable-asan as the error struct is never freed.
> In the case where the test expects a success but it fails, let's also
> report the error for debugging (it will be freed internally).

Oh, nice catch. Thanks!

Reviewed-by: Juraj Marcin <jmar...@redhat.com>

> 
> Fixes 316e8ee8d6 ("util/qemu-sockets: Refactor inet_parse() to use QemuOpts")
> Signed-off-by: Matheus Tavares Bernardino 
> <matheus.bernard...@oss.qualcomm.com>
> ---
>  tests/unit/test-util-sockets.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c
> index 8492f4d68f..ee66d727c3 100644
> --- a/tests/unit/test-util-sockets.c
> +++ b/tests/unit/test-util-sockets.c
> @@ -341,8 +341,12 @@ static void inet_parse_test_helper(const char *str,
>      int rc = inet_parse(&addr, str, &error);
>  
>      if (success) {
> +        if (error) {
> +            error_report_err(error);
> +        }
>          g_assert_cmpint(rc, ==, 0);
>      } else {
> +        error_free(error);
>          g_assert_cmpint(rc, <, 0);
>      }
>      if (exp_addr != NULL) {
> -- 
> 2.37.2
> 


Reply via email to