I have a code which works perfect in serial but with mpirun -n 2 ./out it gives the following error:
./out\': malloc(): smallbin double linked l
You can never go wrong with a Jonathan Dursi answer but let me just add that with more than one processor it can be a pain to read valgrind output.
Instead of outputting to the console, dump it to a log file. Of course you can't dump both processes to the same log file. valgrind interprets '%p' as the process id so you get two (or more) log files:
mpiexec -np 2 valgrind --leak-check=full \
--show-reachable=yes --log-file=nc.vg.%p ./noncontig_coll2 -fname blah