Haxx ad

curl's project page on


cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives


From: Giuliano Montecarlo <>
Date: Sat, 12 Nov 2005 23:55:23 +0100

If I compile the code on windows with Dev-Cpp, it works, but sometimes not.
I tried now to build it for GNU/Linux, but glibc gives me errors.
char* getSite(char* user, char* pass) {
  struct MemoryStruct {
    char *memory;
    size_t size;

  void *myrealloc(void *ptr, size_t size) {
      return realloc(ptr, size);
      return malloc(size);

  size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) {
    size_t realsize = size * nmemb;
    struct MemoryStruct *mem = (struct MemoryStruct *)data;
    mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1);
    if (mem->memory) {
      memcpy(&(mem->memory[mem->size]), ptr, realsize);
      mem->size += realsize;
      mem->memory[mem->size] = 0;
    return realsize;

  CURL *curl_handle;
  CURLcode res;
  struct MemoryStruct chunk;
  chunk.size = 0;
  curl_handle = curl_easy_init();
  char* buff = malloc(sizeof(FREEPAYURL)+strlen(user)+strlen(pass)+1);
  sprintf(buff, FREEPAYURL, user, pass);
  curl_easy_setopt(curl_handle, CURLOPT_URL,
  curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, buff);
  curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
  curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, "");
  curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
  curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
  curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0");
  while(res!=CURLE_OK) {
  return chunk.memory;

gdb gives me:
(gdb) run
Starting program: /home/giuly/GeePod/Interface/GeePod
*** glibc detected *** free(): invalid next size (fast): 0x000000000058ba80 ***

Program received signal SIGABRT, Aborted.
0x00002aaaac347ad9 in kill () from /lib/
(gdb) bt
#0 0x00002aaaac347ad9 in kill () from /lib/
#1 0x00002aaaac3477cd in raise () from /lib/
#2 0x00002aaaac348b12 in abort () from /lib/
#3 0x00002aaaac37acd7 in __fsetlocking () from /lib/
#4 0x00002aaaac37fba0 in malloc_usable_size () from /lib/
#5 0x00002aaaac38070a in free () from /lib/
#6 0x00002aaaabd676e9 in curl_slist_free_all () from /usr/lib/
#7 0x00002aaaabd702b4 in Curl_close () from /usr/lib/
#8 0x0000000000401e34 in getSite ()
#9 0x00000000004023e3 in Update ()
#10 0x0000000000402baa in main ()

So, does anyone know, whats wrong there?

Received on 2005-11-13

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET