Valgrind reports errors for a very simple C program

If the programme you are running through Valgrind is exactly the one you posted in your question, it clearly doesn’t have any memory leaks. In fact, you don’t even use malloc/free yourself!

It looks to me like these are spurious errors / false positives that Valgrind detects on OS X (only!), similar to what happened to myself some time ago.

If you have access to a different operating system, e.g. a Linux machine, try to analyze the programme using Valgrind on that system.

EDIT: I haven’t tried this myself, since I don’t have access to a Mac right now, but you should try what
M Oehm suggested: try to use a supressions file as mentioned in this other SO question.

Leave a Comment