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);
-
     qtest_quit(qts);
 }
 

-- 
2.56.0.116.g6de20f6092dc


Reply via email to