cURL / Mailing Lists / curl-library / Single Mail

curl-library

Problem caused by CURLDEBUG

From: James Housley <jim_at_thehousleys.net>
Date: Sun, 22 Oct 2006 14:56:30 -0400

The default mode of CURLDEBUG is to map free() to curl_dofree(),
which is fine most of the time. However, if an external library does
memory allocation it is not possible to free the memory without an
error or warning. Lets take some very, very simple code.

{
   char *str;
   asprintf(&str, "A simple print\n");
   free(str);
}

This will produce:

curl(1467) malloc: *** Deallocation of a pointer not malloced:
0x110877c; This could be a double free(), or free() called with the
middle of an allocated block; Try setting environment variable
MallocHelp to see tools to help debug

Which is wrong. I used this as a very simple example. The problem I
ran into was a library, on request, allocating a buffer for an error
string.

Jim

--
/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
  X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
jeh@FreeBSD.org      http://www.FreeBSD.org     The Power to Serve
jim@TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?
Received on 2006-10-22