put curl_free in the right place