Check malloc result
Check malloc result

This patch checks malloc was successfull and release resources if it
wasn't.

krezovic/weston,Fantu/compositor-spice,sir-murray/weston,jonnylamb/weston,kwm81/weston,giucam/weston,udoprog/weston,jonnylamb/weston,Fantu/compositor-spice,giucam/weston,mchalupa/weston,Tarnyko/weston-xdg_surface_present,mchalupa/weston,xorgy/weston,udoprog/weston,krezovic/weston,Fantu/compositor-spice,eyolfson/weston,kwm81/weston,xorgy/weston,Gnurou/weston,sir-murray/weston,Gnurou/weston,eyolfson/weston,Tarnyko/weston-xdg_surface_present