cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: about the bug of glibc detected free invalid pointer

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 6 Feb 2008 08:14:01 -0800

On Wed, Feb 06, 2008 at 10:05:17PM +0800, yi xia wrote:
> Hi guys,
> I feel puzzled about one error in using libcurl 7.17.1. To be simply, the
> problem is that if getaddrinfo get timeouted and if the program has more than
> one thread, then libcurl is ended with segmentation,
> *** glibc detected *** ./testcurl: free(): invalid pointer: 0xb7fc9df4 ***
> Segmentation fault

For one thing, you're not calling curl_global_init from only the original
thread, as documented that you must. I doubt that's what's causing the
problem, though, since you only have a single thread that ever executes
a libcurl function. Try using glibc's memory integrity and tracing
features to trace the bad free--look up mtrace and mcheck and set up
your program. Also, if you insist on polling on a global flag as a
thread synchronization method, you should be making g_bEnd volatile.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-02-06