cURL / Mailing Lists / curl-library / Single Mail


Re: Patch to allow GSSAPI authentication to a socks5 server

From: Daniel Stenberg <>
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

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


   return OK;

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

Received on 2009-01-24