fix missing null pointer check after malloc.