cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Patch to allow GSSAPI authentication to a socks5 server

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 24 Jan 2009 22:35:23 +0100 (CET)

On Sat, 24 Jan 2009, Markus Moeller wrote:

>> * I added checks for the malloc() calls I could find with returns on
>> failure. These are not really fine since they will leak memory in case of
>> failure. Adding proper ways to bail out may require use of a few more
>> functions than currently.
>
> I am not sure if I understand where are you getting at. All allocated
> memory will be freed before returning on failure (mostly via gss_.. calls) .

Because I added uncondtional returns on malloc() failures. Like this psuedo
code

   a = get_resource()
   b = malloc()
   if(!b)
     return CURLE_OUT_OF_MEMORY;

   free_resource(a);

   return OK;

When malloc() fails, this function leaks memory (the data 'a' points to). The
patch I posted had this kind of leaks.

-- 
  / daniel.haxx.se
Received on 2009-01-24