Skip to content

Commit

Permalink
tests: fix a memory in test_socket_unix_abstract_good
Browse files Browse the repository at this point in the history
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: 4d3a329("tests/util-sockets: add abstract unix socket cases")
Signed-off-by: Li Qiang <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by:  xiaoqiang zhao <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
  • Loading branch information
terenceli authored and berrange committed Aug 25, 2020
1 parent 4442310 commit 74a57dd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/test-util-sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 74a57dd

Please sign in to comment.