On Mon, Sep 21, 2009 at 2:46 PM, Gross, Tim (Utility Computing Architect) <[email protected]> wrote: > Daniel, > I think I have figured out the problem. I do the following, prior to the > curl_easy_perform() call: > > char *temp_url = new char[100]; > strcpy(temp_url, "http://myserver.com/whatever.cgi"); > cURLres = curl_easy_setopt(m_curl, CURLOPT_URL, temp_url); > free(temp_url); > > From the documentation for curl_easy_setopt(), it appears that the third > parameter (in my code temp_url) is copied and therefore it is safe to > deallocate it after the call to curl_easy_setopt(). But this yields the > failure that I described in my initial message. It seems the problem is that > the url is not valid when I invoke the curl_easy_perform() API. > > Furthermore, when I comment out the "free(temp_url)" statement, it is > successful. This is contrary to the documentation, but seems to be the fix. > Can you confirm this?
Do not use free() with new-allocated data, use delete. Do not use delete with malloc-allocated data, use free(). And try to avoid top-posting. ;) Lars Nilsson
