Close fd on error path in do_mount()

This fix closes a file descriptor before returning
error from do_mount()

Change-Id: Ib370229f16bf9ac385162d6b163cc5b079a1e73e
Fix segfault in get_character_device_symlinks()

A segmentation fault will occur when strchr function returns NULL.

Change-Id: I76076acfff16056179bf24dff5df9f81d9a45125
init: Fix memory corruption when sanitizing platform paths

This commit fixes code that incorrectly increments s when it
hits the terminator character of the string being sanitized.
This means it will randomly start trashing memory beyond the
end of the string being sanitized until it happens to hit two
NULs (\0\0) which will break it out of the loop.

Change-Id: I76553d7f183236a78a0bc7b408e92559b98f732f