free memory after use
fix invalid read in case of empty string