resolved memory leak was use free instead delete