cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: bitmap buffer (c++)

From: <koettermarkus_at_gmx.de>
Date: Sat, 15 Nov 2008 14:52:12 +0100

Hi,

thread was tldr;

problem is
void conta() throw (std::runtime_error){
...
                struct MemoryStruct chunk;
...
                curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
...

Your passing the address of a variable on the stack to curl_easy_setopt,
this variable will be gone once conta() returned.

using

struct MemoryChunk *chunk = (struct MemoryChunk *)malloc(sizeof(struct
MemoryChunk));
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)chunk);

may help.

MfG
Markus
Received on 2008-11-15