Fix a few memory leaks

Also guard against calloc failure in lakka_init.
Merge pull request #1020 from lioncash/leak

Fix a few memory leaks