[RDY] xmalloc and xrealloc: try to free on OOM, but aborts the program if it fails to malloc() again

`xmalloc()` and `xrealloc` inspired by git's `xmalloc` wrapper. [1]

[1] https://github.com/git/git/blob/master/wrapper.c#L45