cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Sending SOAP query using CURLOPT_POST not working for me

From: Lars Nilsson <chamaeleon_at_gmail.com>
Date: Mon, 4 Jan 2010 14:15:21 -0500

On Mon, Jan 4, 2010 at 1:39 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 4 Jan 2010, nitin.mittal_at_rsa.com wrote:
>
>> struct MemoryStruct *bodyStruct=NULL;
>
> ... a global pointer pointing to NULL.
>
>> size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void
>> *data)
>> {
>>        register int realsize = size * nmemb;
>>        struct MemoryStruct *mem = (struct MemoryStruct *)data;
>>
>>        mem->memory = (char *)realloc(mem->memory, mem->size + realsize
>> + 1);                 // Application crashes here.
>
> Well yes, as 'mem' is NULL...

realloc() shouldn't have a problem dealing with a NULL pointer.
However, the Init() function does assign a value to bodyStruct using
malloc(). Using malloc() and not initializing the memory would be a
source of badness though. No telling what their values may be without
it.

Lars Nilsson
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-04