demo.c: In function ‘calls_free’: demo.c:6:3: warning: double-free of ‘victim’ [CWE-415] 6 | free (victim); | ^~~~~~~~~~~~~ cc1: note: summary of interprocedural path ‘test’: events 1-2 | | 11 | void test (void *ptr) | | ^~~~ | | | | | (1) entry to ‘test’ |...... | 15 | calls_free (ptr); | | ~~~~~~~~~~~~~~~~ | | | | | (2) calling ‘calls_free’ from ‘test’ | +--> ‘calls_free’: events 3-4 | | 4 | calls_free (void *victim) | | ^~~~~~~~~~ | | | | | (3) entry to ‘calls_free’ | 5 | { | 6 | free (victim); | | ~~~~~~~~~~~~~ | | | | | (4) first ‘free’ here | <----------+ | ‘test’: events 5-6 | | 15 | calls_free (ptr); | | ^~~~~~~~~~~~~~~~ | | | | | (5) returning to ‘test’ from ‘calls_free’ |...... | 19 | calls_free (ptr); | | ~~~~~~~~~~~~~~~~ | | | | | (6) calling ‘calls_free’ from ‘test’ | +--> ‘calls_free’: events 7-8 | | 4 | calls_free (void *victim) | | ^~~~~~~~~~ | | | | | (7) entry to ‘calls_free’ | 5 | { | 6 | free (victim); | | ~~~~~~~~~~~~~ | | | | | (8) second ‘free’ here | demo.c: In function ‘test’: demo.c:11:6: note: (1) entry to ‘test’ 11 | void test (void *ptr) | ^~~~ ...... 15 | calls_free (ptr); | ~~~~~~~~~~~~~~~~ | | | (2) calling ‘calls_free’ from ‘test’ demo.c: In function ‘calls_free’: demo.c:4:1: note: (3) entry to ‘calls_free’ 4 | calls_free (void *victim) | ^~~~~~~~~~ 5 | { 6 | free (victim); | ~~~~~~~~~~~~~ | | | (4) first ‘free’ here demo.c: In function ‘test’: demo.c:15:3: note: (5) returning to ‘test’ from ‘calls_free’ 15 | calls_free (ptr); | ^~~~~~~~~~~~~~~~ ...... 19 | calls_free (ptr); | ~~~~~~~~~~~~~~~~ | | | (6) calling ‘calls_free’ from ‘test’ demo.c: In function ‘calls_free’: demo.c:4:1: note: (7) entry to ‘calls_free’ 4 | calls_free (void *victim) | ^~~~~~~~~~ 5 | { 6 | free (victim); | ~~~~~~~~~~~~~ | | | (8) second ‘free’ here