Handle allocation errors in inflate decompressor

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
Refactor and optmize loader code

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>