[RDY] Memory functions: Improve style.

`try_malloc` was changed in 8bb2c2c0742c57150655e18cf8418a758cebdce8 to
avoid a warning when size is 0.

Code style was also improved on suggestion by @aktau.
This just applies the same style improvements to other similar
functions, to keep code homogeneous.