fix the memory allocation failed.