rewrite gss_krb5_ccache_name

Stephen Ince since at opendemand.com
Mon Nov 24 12:29:03 EST 2008


Sorry let me clear it up.
1) not_needed_name buffer has a memory leak.
2) NULL has a memory leak.
3) "" has a memory leak.
Actually all three have the same number of bytes leaked.
In case 1 purify complains that the memory is being freed twice.

----- Original Message ----- 
From: "Douglas E. Engert" <deengert at anl.gov>
To: <jaltman at secure-endpoints.com>
Cc: "krbdev" <krbdev at mit.edu>; "Jeffrey Hutzelman" <jhutz at cmu.edu>
Sent: Monday, November 24, 2008 12:18 PM
Subject: Re: rewrite gss_krb5_ccache_name


> 
> 
> Jeffrey Altman wrote:
>> Douglas E. Engert wrote:
>>>
>>> Stephen Ince wrote:
>>>> Thx. Not really possible and has other side effects. We need the
>>>> application needs to run as lean as possible. One thread consumes a
>>>> lot of memory and will have to be around for the life of the program.
>>>> At one point you could have 2000 threads and at another point 10
>>>> threads. We basically simulate browsers and their http connections.
>>>
>>> As a temporary fix, could you do something like:
>>>
>>> char * not_needed_name;
>>> gss_buffer_desc not_needed_buffer;
>>>
>>> not_needed_name = NULL;
>>> major_status =gss_krb5_ccache_name(&minor_status,
>>>                                       krb5_ccache_name,
>>>                                       &not_needed_name);
>>> if (not_needed_name) {
>>>    not_needed_buffer.length = strlen(not_needed_name)+1;
>>>    not_needed_buffer.value = not_needed_name;
>>>    gss_release_buffer(&minor_status, &not_needed_buffer);
>>>    not_needed_name = NULL;
>>> }
>>>
>>> This would then allow you application to get the string
>>> so it can be freeded, but let the gssapi lib use the free()
>>> function linked with the lib.
>> Doug:
>> 
>> That could be done byt why do it when passing NULL instead of
>> &not_needed_name causes gss_krb5_ccache_name() to free the
>> C string instead of returning it?
> 
> I might have miss understood the problem. I though he was saying the
> when he use the NULL there was a leak. But if he passed &not_needed_name
> the library would not leak, and he could then free the string using this
> trick.
> 
>> 
>> Jeffrey Altman
>> 
>> 
>> 
>> ------------------------------------------------------------------------
>> 
>> _______________________________________________
>> krbdev mailing list             krbdev at mit.edu
>> https://mailman.mit.edu/mailman/listinfo/krbdev
> 
> -- 
> 
>  Douglas E. Engert  <DEEngert at anl.gov>
>  Argonne National Laboratory
>  9700 South Cass Avenue
>  Argonne, Illinois  60439
>  (630) 252-5444
> _______________________________________________
> krbdev mailing list             krbdev at mit.edu
> https://mailman.mit.edu/mailman/listinfo/krbdev
>



More information about the krbdev mailing list