core/alarm: fix memory leak

Reported by Coverity scan as CID #971007.
core/cache: close() mmapped cache store

The file will actually get closed when unmapped but we should
remove our reference to it.

Reported by Coverity scan as CID #971009.
core/emperor: fix memory leak on error path

Reported by Coverity as CID #971011.
core/io: check realloc() return value

Reported by Coverity as CID #981513.
core/cache: fix memory leak

Reported by Coverity as CID #981514.
Merge pull request #157 from xrmx/coverity7

More issues reported by Coverity