correctly free readline output