cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: [ curl-Bugs-610674 ] Inconsistency in memory allocation

From: Philippe Lhoste <PhiLho_at_GMX.net>
Date: Wed, 18 Sep 2002 12:57:45 +0000 (UTC)

> Bugs item #610674, was opened at 2002-09-17 10:33
> Category: libcurl
> Group: bad behaviour
> Summary: Inconsistency in memory allocation
>
> Initial Comment:
> libcurl has at least two functions (curl_escape and
> curl_unescape), which return a pointer to memory that
> libcurl itself is allocating, but it does not provide a
> function that libcurl can free this memory.
> The documentation says to use free () on the memory
> returned.
> This is problematic in the general case: It works, if both,
> libcurl and the caller use the same underlying memory
> management. But it will fail if this is not the case.
[snip]
> The solution to this issue is to provide a void curl_free
> (void*).
[snip]

Excellent idea! I believe any library providing memory allocated by itself
should provide a free() function.
I hit the same problem with a client provided DLL.
The DLL was compiled with Visual C++ 5 (release mode), we use VC++6 (debug
mode), and of course freeing the memory was wrong...
We had to create a small DLL just desallocation memory the way it was
allocated... What a waste!

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
-------------------------------------------------------
This SF.NET email is sponsored by: AMD - Your access to the experts
on Hammer Technology! Open Source & Linux Developers, register now
for the AMD Developer Symposium. Code: EX8664
http://www.developwithamd.com/developerlab
Received on 2002-09-18