我遇到了麻烦,下面的代码编译得很好,但是当我运行它时,在它输出文件后,我得到了内存泄漏。
#include <iostream>
#include "include\curl\curl.h"
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://api.del.icio.us/dt");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, true);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_easy_setopt(curl, CURLOPT_CAINFO, "C:\\Users\\bryan\\GeoTrustGlobalCA.crt");
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
我在 Windows vista 机器上使用 gcc 4.7.0 编译它,使用:
g++ -DCURL_STATICLIB testing.cpp -L lib -lcurl -lidn -lwldap32 -lssh2 -lz -lrtm -lcrypto -lgdi32 -lws2_32 -lwinmm -lssl -leay32 -liconv -o testing.exe
知道什么可能导致此内存泄漏吗?