0
当我执行curl_easy_perform我那么做了curl_easy_cleanup像这样:curl_easy_cleanup犯规明确卷曲指针
CURL* pEasy = nullptr;
pEasy = curl_easy_init();
if (pEasy != nullptr)
{
curl_easy_setopt(pEasy, CURLOPT_USERNAME, user.c_str());
curl_easy_setopt(pEasy, CURLOPT_PASSWORD, pass.c_str());
curl_easy_setopt(pEasy, CURLOPT_URL, urlToConnectTo.c_str());
curl_easy_setopt(pEasy, CURLOPT_WRITEFUNCTION, OnReceiveHttpResponse);
curl_easy_perform(pEasy);
curl_easy_cleanup(pEasy);
}
我在调试注意到pEasy指针的地址和它说0x2af0ad18但之后,我它的curl_easy_cleanup其仍然0x2af0ad18。
之后我必须将它设置为nullptr吗? 我会期待curl_easy_cleanup为我重置这个吗?
_“我是否必须将它设置为nullptr?”_可能。分配的内存从'pEasy'中的地址中释放并不会自动将其设置为'nullptr'。 –