Extend smpi_register_static to accept any free function.
Fix memory leaks in smpi.
Try to fix const madness.

See http://c-faq.com/ansi/constmismatch.html for a related FAQ.
Remove useless statements.