When I send this below mail, I see a segfault :(. 
But I can at least say that it has reduced the segfault occurrence but
this is definitely not a fix.

-----Original Message-----
From: Pinakin Mevawala 
Sent: Wednesday, December 16, 2009 9:22 PM
To: the curl tool
Subject: RE: segfault in curl_formfree() in persistence run on RHEL5
x86-64as 64 bit app

This issue is not easily reproduced. It works most of the time but as we
are continuously posting data, it is segfautling at some point of time.
I made one code change in the following method. Added memset call. I
know that we don't need that for calloc but this seems to fix the issue.
I haven't seen the crash since long. We have curl 7.10.7 working fine on
32 bit RHEL for the same scenario and same code.

static FormInfo * AddFormInfo(char *value,
                              char *contenttype,
                              FormInfo *parent_form_info)
{
  FormInfo *form_info;
  form_info = calloc(sizeof(FormInfo), 1);
  if(form_info) {
    memset(form_info , 0, sizeof(FormInfo)); // added line
...
}

I see form ( during next=form->next) as invalid address for the
following method during crash.

* curl_formfree() is an external function to free up a whole form post
 * chain
 */
void curl_formfree(struct curl_httppost *form)
{
  struct curl_httppost *next;

  if(!form)
    /* no form to free, just get out of this */
    return;

  do {
    next=form->next;  /* the following form line */


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Daniel Stenberg
Sent: Wednesday, December 16, 2009 8:56 PM
To: the curl tool
Subject: Re: segfault in curl_formfree() in persistence run on RHEL5
x86-64as 64 bit app

On Wed, 16 Dec 2009, Pinakin Mevawala wrote:

For libcurl stuff, please use the curl-library list!

> I'm facing the segfault in curl_formfree() in persistence run on RHEL5
> x86-64 as 64 bit app. Using CURL 7.19.5.

...

>   curl_formadd(&post, &last,
>                 CURLFORM_COPYNAME, POST_NAME,
>                 CURLFORM_FILECONTENT, file_name,
>                 CURLFORM_CONTENTTYPE, (char*)content_type,

Did you by any chance have any of the post or last pointers
uninitialized?

When you send this to the correct mailinglist, can you show us the stack
trace 
or even better a valgrind output for this case? Or perhaps even a small 
example that repeats the problem.

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to