Marc-André Lureau <[email protected]> writes:

> Reported by ASAN.
>
> Fixes: 6d459c75cfc4 ("tests/qtest: add test for exynos4210 uart fifo overflow 
> bug")
> Signed-off-by: Marc-André Lureau <[email protected]>
> ---
>  tests/qtest/exynos4210_uart_fifo-test.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/tests/qtest/exynos4210_uart_fifo-test.c 
> b/tests/qtest/exynos4210_uart_fifo-test.c
> index 54c09a6de723..c336ed22b028 100644
> --- a/tests/qtest/exynos4210_uart_fifo-test.c
> +++ b/tests/qtest/exynos4210_uart_fifo-test.c
> @@ -52,8 +52,8 @@ static void enable_uart_fifo(QTestState *qts)
>   */
>  static void test_recv_large_str(void)
>  {
> -    int sock_fd;
> -    char *sendbuf, *recvbuf;
> +    g_autofd int sock_fd = -1;
> +    g_autofree char *sendbuf = NULL, *recvbuf = NULL;
>      QTestState *qts = qtest_init_with_serial("-M smdkc210", &sock_fd);
>  
>      enable_uart_fifo(qts);
> @@ -71,8 +71,6 @@ static void test_recv_large_str(void)
>      g_assert_true(TEST_BUFFER_LEN - 1 == strlen(recvbuf));
>      g_assert_true(strcmp(sendbuf, recvbuf) == 0);
>  
> -    close(sock_fd);
> -

Did the close(sock_fd) fail or is this just adding another auto free
while cleaning up the buffer pointers? Anyway:

Reviewed-by: Alex Bennée <[email protected]>


>      qtest_quit(qts);
>  }

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Reply via email to