This can be misleading...
void foo(char *buf) {
...
free(buf);
buf = NULL;
}
void bar() {
char *b = malloc(123);
foo(b);
// b isn't NULL...
}
My advice is: always compile and run with AddressSanitizer. Take the time to fix errors/leaks as soon as possible.