sfc: Added checks for heap allocation failure