Added function to fre sql statement memory