cURL / Mailing Lists / curl-users / Single Mail


Re: lib cURL instability and stack/stream-related crashes in easy_perform

From: Linus Nielsen Feltzing <>
Date: Sun, 19 Dec 2004 22:13:42 +0100

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.


char *get_user_input(void)
    char buffer[100];
    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...

Received on 2004-12-19