cURL
Haxx ad
libcurl

Shopping cart software, Online file storage, Online photo storage, Hosted shopping cart, Contact management software, Email marketing software, Project management software, Issue tracking software, Online notepad, Web publishing software

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Archives

Re: What is the proper way to get libcurl to free it resources when used within a C++ Class?

From: <johansen_at_sun.com>
Date: Tue, 24 Nov 2009 12:16:28 -0800

On Tue, Nov 24, 2009 at 11:47:30AM -0800, Dantzler, DeWayne C wrote:
>
> I'm not calling curl_global_init()/curl_global_cleanup() more than
> once. I'm calling them only once. Xerces is a 3rd party library and I
> have no access to the source or know how they are using curl in the
> their library. This is a large C++ application and I'm using curl in
> only one class. In my ctor, I call curl_global_init() first then make
> a call to curl_easy_init(). According to the curl documentation, if
> you call curl_global_init(), you should call curl_global_cleanup().
> Likewise it says if you call curl_easy_init(), then you should call
> curl_easy_cleanup(), but when I do this the application crashes with a
> SIGSEGV, Segmentation fault.

It's unusual to only have one instance of a class, which is why I also
wondered if curl_global_init() / curl_global_cleanup() was getting
invoked more than once per program execution.

> The call stack shows:
> Results:Program received signal SIGSEGV, Segmentation fault.
> =================================================
> #0 0x63912920 in Curl_cookie_loadfiles+0x9c ()
> #1 0x63933c74 in flush_cookies+0x8c ()
> #2 0x639341ac in Curl_close+0x2ac
> #3 0x639624e8 in curl_easy_cleanup+0x3c ()

Regardless, this stack is occuring in every instance where you call
curl_easy_cleanup(), irrespective of the order of your
easy_cleanup/global_cleanup calls. If I had to hazard a guess, there's
a NULL pointer de-reference while traversing the list in
cookie_loadfiles.

I would work backwards and see if removing any of the CURLOPT_COOKIE*
options eliminates the problem. If so, figure out what combination of
options is causing the problem, write a small test case, and send it to
the list. This will make it easy for people to help you debug.

Good Luck,

-j
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-24

These mail archives are generated by hypermail.

donate! Page updated November 16, 2009.
web site info

File upload with ASP.NET