cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Crash in curl

From: Andreas Volz <lists_at_brachttal.net>
Date: Tue, 19 Feb 2008 00:09:18 +0100

Am Mon, 18 Feb 2008 23:45:34 +0100 schrieb Andreas Volz:

> Am Mon, 18 Feb 2008 09:03:10 +0100 schrieb Linus Nielsen Feltzing:
>
> > Andreas Volz wrote:
> > > int Download::webget (const string &url, const string &filename)
> > > {
> > > long httpResponse;
> > >
> > > // specify URL to get
> > > curl_easy_setopt(m_curlHandle, CURLOPT_URL, url.c_str ());
> >
> > If you are using version 7.16.4, this statement might cause a
> > problem if the c_str() method creates a temporary char pointer.
> > However, 7.17.1 will not have that problem, since it copies the
> > string.
>
> Ok, but I have that stl string at this point. I could copy it to a
> temporary char*. But how long should I hold it in memory for curl?
>
> Beside I'll test 7.17.1.

Ok, I've tested 7.17.1 on Ubuntu and have no more segfaults so far. It
seems that is the reason for it. But I would like to make my app
compatible with 7,16.4 if possible. So how long do I need to hold the
char* for curl?

regards
Andreas
Received on 2008-02-19