Add missing check in malloc return value