Check malloc for success before using result
Tabbed whitespace to match repo style