SQLite Forum

memory leaks in sqlite3.c:23618
I downloaded that file you linked. Because it looked like rubbish of some kind, with only sporadic and slight resemblance to anything that might be reasonably input to the SQLite3 shell, I ignored it for days.  But it kept bugging me that code which so clearly reads as correct, (in shell.c in do\_meta\_command() as indicated above), would leak or be tagged as leaking.  Interestingly, that code does a realloc, (also handled correctly), so I wondered if it was a false positive, possibly due to not instrumenting realloc() calls properly.

Curiosity finally prevailed, so, I: instrumented a shell build with leak detection, ([for MSVC via the CRT](https://docs.microsoft.com/en-us/visualstudio/debugger/finding-memory-leaks-using-the-crt-library?view=vs-2019)); tested it by temporarily commenting out a free() call; then ran it under the debugger so that the detection output to the "debug window" could be seen. When I do this and shove that rubbishy POC_6_000667 file into its input, then tell it to exit whereupon leaks are reported, no leaks are reported.

Because the code weakly implicated as being leaky by the OP does not have platform-specific logic related to allocation, I contend that this test shows the LeakSanitizer to either have been misused or be unable to track realloc operations properly.

I intend to now ignore this putative "bug" which seems to depend upon an unstated application of LeakSanitizer.