[474] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

Re: Where does allocated memory go?

daemon@ATHENA.MIT.EDU (Theodore Ts'o)
Thu May 19 15:10:11 1994

Date: Thu, 19 May 94 15:09:45 EDT
From: tytso@MIT.EDU (Theodore Ts'o)
To: georgesr@wrq.com
Cc: krb5-bugs@MIT.EDU
In-Reply-To: georges rahbani's message of Wed, 18 May 1994 15:04:36 -0700,
	<9405182205.AA20703@MIT.EDU>

   Date: Wed, 18 May 1994 15:04:36 -0700
   From: georgesr@wrq.com (georges rahbani)

   In the following function "krb5_get_credentials" we do a call first to 
   retrieve the credentials from the ccache. retrieve do allocate new memory 
   for the credential componentents. What happens to the already allocated 
   memory. It seems to get lost. In the case where this function calls the 
   get_cred_from_kdc the same thing happens. What am I missing? Many questions 
   I would like to ask:

   1. Is this the appropriate place to ask these questions?

Yes.

   2. If yes, Where do the previous server and client structure that hang from 
   creds get deallocated? How about the authorization array and the host 
   address array? 

They're not; they should be; you've found a bug.  :-)

The memory allocation convention which krb5 follows (or tries to follow)
is that in routines where a structure can be mutated, the called
function will deallocate any structure members which it replaces.

I thought I had fixed them all in beta 3 (notice that
krb5_get_cred_via_tgt() and krb5_get_cred_via_2tgt() do the right
thing), but you've just pointed out an embarassing oversight on my part.
Thanks.  It'll be fixed for the next release.....

   3. I am going through the Kerberos code line by line and porting it to the 
   PC. I may encounter many such questions, would you like to know about them?

Yes indeed.  If you'd be willing to feed back any changes you had to
make in order to port them to the PC, I would really appreciate it.

						- Ted

home help back first fref pref prev next nref lref last post