These `malloc` functions look so nice like this. :) They're inspired by `git`'s implementation [1].

[1] https://github.com/git/git/blob/master/wrapper.c#L45