[1316] in Kerberos-V5-bugs

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

Memory leak in krb5_rc_dfl_expunge

daemon@ATHENA.MIT.EDU (epeisach@MIT.EDU)
Wed Mar 29 00:06:36 1995

From: epeisach@MIT.EDU
Date: Wed, 29 Mar 1995 00:06:28 -0500
To: krb5-bugs@MIT.EDU


The way that expunge seems to function is that 
a) The current cache is closed
b) The current cache is reopened
c) A temporary cache is opened
d) Items from the current cache are copied to the temporary one. 
The cache items appear t go directly to disk and are not insrted in the
in memory hash table cache for the temp structure.
e) The current cache is closed 
f) The pointer to the open tmp cache are copied in place of the old one.

What is not freeed - the temp rcache structure. We have to fool the
system into not closing the temp open file - which is pointed to by the
current and the temp rcache... (This in itself may be a bug)...


This leak may seem small, but in a server which expunges periodically,
there is a loss of about 7K per expunge.

	Ezra

Index: rc_dfl.c
===================================================================
RCS file: /mit/krb5/.cvsroot/src/lib/krb5/rcache/rc_dfl.c,v
retrieving revision 5.27
diff -c -r5.27 rc_dfl.c
*** rc_dfl.c	1995/03/01 23:25:18	5.27
--- rc_dfl.c	1995/03/29 04:54:57
***************
*** 590,595 ****
--- 590,599 ----
  	return KRB5_RC_IO;
      if (krb5_rc_io_move(context, &t->d, &((struct dfl_data *)tmp->data)->d))
  	return KRB5_RC_IO;
+     /* Fool the system into thinking we closed the file instead of
+        moving the pointers to the new structure */
+     ((struct dfl_data *)tmp->data)->d.fd = -1;
+     (void) krb5_rc_dfl_close(context, tmp);
  #endif
      return 0;
  }

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