malloc's result checking
malloc's result checking
cosmetic changes