libcurl easy_perform崩溃

时间:2016-05-23 18:29:03

标签: c++ libcurl

我正在使用libcurl easy模式尝试发送请求。遵循示例代码,但得到了一个seg错误:

 curl_global_init(CURL_GLOBAL_ALL);  
CURL *easyhandle = curl_easy_init();                                                                 

        //allow no certificates                                                                              
        curl_easy_setopt(easyhandle, CURLOPT_SSL_VERIFYPEER, 0L);                                            

        //give lib curl the URL                                                                              
        curl_easy_setopt(easyhandle, CURLOPT_URL, urlString);                                                

        //set the callback                                                                                   
        curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, &routingCallback);                               

        res = curl_easy_perform(easyhandle);                                                                 


        //clean up the easy handle                                                                           
        curl_easy_cleanup(easyhandle);               

然后当我在GDB中调试时:

Starting program: /home/michaelamici/Documents/bbb/hrouter 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff2a02700 (LWP 3829)]
[Thread 0x7ffff2a02700 (LWP 3829) exited]

Program received signal SIGSEGV, Segmentation fault.
__GI___libc_free (mem=0x6) at malloc.c:2949
2949      if (chunk_is_mmapped (p))                       /* release mmapped memory. */
(gdb) 

我很肯定网址是正确的,因为我从curl CLI获得响应

0 个答案:

没有答案