tests: fix a memory in test_socket_unix_abstract_good
PATCH 1/1 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.
--- tests/test-util-sockets.c | 1 + 1 file changed, 1 insertion(+)
tests/test-util-sockets.c +1 -0
@@ -312,6 +312,7 @@ static void test_socket_unix_abstract_good(void)g_thread_join (serv);g_free (abstract_sock_name); + g_rand_free(r); }#endif
Signature · 1 line
2.17.1
Quoted 6 lines · Li Qiang
After build qemu with '-fsanitize=address' extra-cflags, 'make check' show following leak:
=================================================================
==44580==ERROR: LeakSanitizer: detected memory leaks
Quoted 8 lines
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.
GLib doc doesn't seem complete (they don't mention explicitly the generator returned from g_rand_new has to be released with g_rand_free).
Quoted 20 lines
Fixes 4d3a329af59("tests/util-sockets: add abstract unix socket cases")Signed-off-by Li Qiang <[email protected]>--- tests/test-util-sockets.c | 1 + 1 file changed, 1 insertion(+)tests/test-util-sockets.c +1
-0@@ -312,6 +312,7 @@ static void test_socket_unix_abstract_good(void)g_thread_join (serv);g_free (abstract_sock_name); + g_rand_free(r); }#endif
Quoted 26 lines · Li Qiang
After build qemu with '-fsanitize=address' extra-cflags, 'make check' show following leak:
=================================================================
==44580==ERROR: LeakSanitizer: detected memory leaksDirect 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 <[email protected]>--- tests/test-util-sockets.c | 1 + 1 file changed, 1 insertion(+)tests/test-util-sockets.c +0
-0
tests/test-util-sockets.c static void test_socket_unix_abstract_good(void) · line 318
Quoted 7 lines
tests/test-util-sockets.c +1
-0@@ -312,6 +312,7 @@ static void test_socket_unix_abstract_good(void)g_thread_join (serv);g_free (abstract_sock_name); + g_rand_free(r); }#endif
Ping..
Anyone queued this?
Thanks,
Li Qiang
Quoted 40 lines · Li Qiang <[email protected]> 于2020年6月4日周四 上午12:31写道:
After build qemu with '-fsanitize=address' extra-cflags, 'make check' show following leak:
=================================================================
==44580==ERROR: LeakSanitizer: detected memory leaksDirect 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 <[email protected]>--- tests/test-util-sockets.c | 1 + 1 file changed, 1 insertion(+)tests/test-util-sockets.c +1
-1@@ -312,6 +312,7 @@ static void test_socket_unix_abstract_good(void)g_thread_join (serv);g_free (abstract_sock_name); + g_rand_free(r); }#endif --2.17.1
Quoted 2 lines · Li Qiang
Ping..
Anyone queued this?
Thanks, I've queud this now.
Quoted 41 lines
Thanks,
Li QiangQuoted 35 lines · Li Qiang <[email protected]> 于2020年6月4日周四 上午12:31写道:
After build qemu with '-fsanitize=address' extra-cflags, 'make check' show following leak:
=================================================================
==44580==ERROR: LeakSanitizer: detected memory leaksDirect 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 <[email protected]>--- tests/test-util-sockets.c | 1 + 1 file changed, 1 insertion(+)tests/test-util-sockets.c +1
-0@@ -312,6 +312,7 @@ static void test_socket_unix_abstract_good(void)g_thread_join (serv);g_free (abstract_sock_name); + g_rand_free(r); }#endif
Quoted 5 lines
Quoted 5 lines
--
2.17.1
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 6 lines · Daniel P. Berrangé <[email protected]> 于2020年6月24日周三 下午6:56写道:
Quoted 2 lines · Li Qiang
Ping..
Anyone queued this?Thanks, I've queud this now.
Hi Daniel,
It seems this patch still not in the upstream.
Thanks,
Li Qiang
Quoted 55 lines
Quoted 42 lines
Thanks,
Li QiangQuoted 35 lines · Li Qiang <[email protected]> 于2020年6月4日周四 上午12:31写道:
After build qemu with '-fsanitize=address' extra-cflags, 'make check' show following leak:
=================================================================
==44580==ERROR: LeakSanitizer: detected memory leaksDirect 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 <[email protected]>--- tests/test-util-sockets.c | 1 + 1 file changed, 1 insertion(+)tests/test-util-sockets.c +1
-0@@ -312,6 +312,7 @@ static void test_socket_unix_abstract_good(void)g_thread_join (serv);g_free (abstract_sock_name); + g_rand_free(r); }#endif Quoted 5 lines
Quoted 5 lines
--
2.17.1Regards,
Daniel
--|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 2 lines · Li Qiang
Hi Daniel,
It seems this patch still not in the upstream.