removed unnecessary null check conditions to free pointers