codegen_malloc/realloc: static + simple mem alloc

- there's no reason for both to have external linkage
- use simple versions of memory allocation functions
which are returning NULL instead of longjmp-ing,
so codegen_error will be called to cleanup.
Merge pull request #1585 from cremno/codegen-fixes

codegen_malloc/realloc: static + simple mem alloc