K
Size: a a a
K
K
gcc -std=c99 -fsanitize=address main.c
SK
K
SK
K
Е
IS
TS
gcc -std=c99 -fsanitize=address main.c
g++ main.cpp -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address
[localhost ~]$ ./a.out
=================================================================
==18536==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 7 byte(s) in 1 object(s) allocated from:
#0 0x7f3f5c898667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
#1 0x401157 in main (/home/user/a.out+0x401157)
#2 0x7f3f5b977041 in __libc_start_main (/lib64/libc.so.6+0x27041)
SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s).
IS
SK
g++ main.cpp -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address
[localhost ~]$ ./a.out
=================================================================
==18536==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 7 byte(s) in 1 object(s) allocated from:
#0 0x7f3f5c898667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
#1 0x401157 in main (/home/user/a.out+0x401157)
#2 0x7f3f5b977041 in __libc_start_main (/lib64/libc.so.6+0x27041)
SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s).
IS
IS
TS
IS
CD
IS
m
IS
m
release()
демонстрировать. Ну или просто на shared_ptr
, что гораздо более жизненно.