Function to free allocated space added.