aboutsummaryrefslogtreecommitdiff
path: root/tests/test-util-sockets.c
diff options
context:
space:
mode:
authorLi Qiang <liq3ea@163.com>2020-06-03 09:14:09 -0700
committerDaniel P. Berrangé <berrange@redhat.com>2020-08-25 11:49:49 +0100
commit74a57ddc02c41f8f4bb549cedb107c1086daba58 (patch)
treee92833190126d88a3630bbbe735826b762db7740 /tests/test-util-sockets.c
parent44423107e7b5731ef40c5c8632a5bad8b49d0838 (diff)
downloadqemu-74a57ddc02c41f8f4bb549cedb107c1086daba58.zip
qemu-74a57ddc02c41f8f4bb549cedb107c1086daba58.tar.gz
qemu-74a57ddc02c41f8f4bb549cedb107c1086daba58.tar.bz2
tests: fix a memory in test_socket_unix_abstract_good
After build qemu with '-fsanitize=address' extra-cflags, 'make check' show following leak: ================================================================= ==44580==ERROR: LeakSanitizer: detected memory leaks Direct leak of 2500 byte(s) in 1 object(s) allocated from: #0 0x7f1b5a8b8d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28) #1 0x7f1b5a514b10 in g_malloc0 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x51b10) #2 0xd79ea4e4c0ad31c3 (<unknown module>) SUMMARY: AddressSanitizer: 2500 byte(s) leaked in 1 allocation(s). Call 'g_rand_free' in the end of function to avoid this. Fixes: 4d3a329af59("tests/util-sockets: add abstract unix socket cases") Signed-off-by: Li Qiang <liq3ea@163.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:  xiaoqiang zhao <zxq_yx_007@163.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'tests/test-util-sockets.c')
-rw-r--r--tests/test-util-sockets.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c
index 261dc48..af9f5c0 100644
--- a/tests/test-util-sockets.c
+++ b/tests/test-util-sockets.c
@@ -313,6 +313,7 @@ static void test_socket_unix_abstract_good(void)
g_thread_join(serv);
g_free(abstract_sock_name);
+ g_rand_free(r);
}
#endif