curl-users
Re: lib cURL instability and stack/stream-related crashes in easy_perform
Date: Sun, 19 Dec 2004 17:50:48 -0500
Well, first of all my code is not using local members outside of the
function where they are declared. Second of all, even if it were how
does this relate to the problem? Third of all it's lib curl (or
something lib curl is calling internally) that is crashing, not my code.
-- John Chamberlain
Linus Nielsen Feltzing wrote:
> John Chamberlain wrote:
>
>> From the above cases A and B you can see how I came across the
>> problem. I had code that was working perfectly fine, but when I added
>> an additional level of call cURL started crashing inside
>> easy_perform. After extensive experimentation I found that if I
>> called the function random_actions before beginning the curl
>> operations for some reason it would not crash. This is mysterious
>> because this function does absolutely nothing other than declare some
>> local variables (which are never used) and do a malloc. For example,
>> with everything exactly the same if I delete only the declaration
>> "int y" (which is never used) that is enough to be the difference
>> between easy_perform crashing and not crashing. It is repeatable.
>
>
> From your description, it sounds like you, for example, are storing
> the user input in a local character array on the stack, and then use a
> pointer to it after the function has returned.
>
> Example:
>
> char *get_user_input(void)
> {
> char buffer[100];
> gets(buffer);
> return buffer;
> }
>
> Or is the curl handle stored somewhere on the stack, and accidentally
> freed by returning from the function that initialized it?
>
> Just guessing here, since you didn't show us the actual program...
>
> Linus
>
Received on 2004-12-20