[krbdev.mit.edu #2885] krb5 1-4 introduced memory leak in krb5_get_credentials

Ezra Peisach via RT rt-comment at krbdev.mit.edu
Sun Jan 16 13:02:47 EST 2005


Ken Raeburn via RT wrote:

>Ugh.  I knew there was a leak with the new code, but didn't think it 
>was a new one.
>
>
>  
>
I think the problem is the whole tgt handling... I really think two 
variables are needed...
A free_tgt and free_otgt... Then one needs to set one or the other.  
When otgt becomes
tgt - need to free the otgt and not the other.

There is also questionable code in the middle.... After assigning otgt 
from tgt there are calls to get
a new tgt in tgt... with krb5_cc_retrieve_cred (line 235)... If it 
fails, the code assums that tgt
is still valid... (which it is by happenchance, but I would not keep it).

Also -  when integrating the patch, the cleanup code has a problem...
free_tgt is set if ntgts ==0, but the test for freeing is only if ntgts 
!= 0... I think it should
not be an else if there...

I will need to carefully trace all uses of the tgt variable - but I 
think keeping track of
tgt vs otgt needing freeing is the way to go...

Ezra



More information about the krb5-bugs mailing list