; cat double-free.c
#include <stdlib.h>
int main(int argc, char *argv[]) { char *p = malloc(sizeof(char)); *p = 'x'; free(p); free(p); }
# 2022-01-29T18:12+01:00 $home/src
; gcc -fno-omit-frame-pointer -g double-free.c -fsanitize=address && ./a.out; unlink ./a.out
=================================================================
==9917==ERROR: AddressSanitizer: attempting double-free on 0xb55007b0 in thread T0:
#0 0xb7a351ab in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:123
#1 0x468258 in main /home/nils/src/double-free.c:2
#2 0xb77bee45 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x1ee45)
#3 0x4680d0 in _start (/home/nils/src/a.out+0x10d0)
0xb55007b0 is located 0 bytes inside of 1-byte region [0xb55007b0,0xb55007b1)
freed by thread T0 here:
#0 0xb7a351ab in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:123
#1 0x46824a in main /home/nils/src/double-free.c:2
#2 0xb77bee45 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x1ee45)
previously allocated by thread T0 here:
#0 0xb7a354bb in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x468200 in main /home/nils/src/double-free.c:2
#2 0xb77bee45 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x1ee45)
SUMMARY: AddressSanitizer: double-free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:123 in __interceptor_free
==9917==ABORTING
# 2022-01-29T18:12+01:00 $home/src