Malloc error handling unification