Trace logging file descriptor leak
authorGreg Hudson <ghudson@mit.edu>
Sun, 13 Feb 2011 19:12:36 +0000 (19:12 +0000)
committerGreg Hudson <ghudson@mit.edu>
Sun, 13 Feb 2011 19:12:36 +0000 (19:12 +0000)
File descriptors created for trace logging were never being closed.
With short-lived contexts this leak would eventually overflow the
process's file table.  Correct this oversight by closing the file
descriptor in file_trace_cb before freeing its container.

ticket: 6867
target_version: 1.9.1
tags: pullup

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24634 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/trace.c

index 30942cd9752f56662a7173bbc5385a3eb8a25ac9..3138aaf0f9e6a09461aa07aac5b3108561b476bd 100644 (file)
@@ -321,6 +321,7 @@ file_trace_cb(krb5_context context, const struct krb5_trace_info *info, void *da
 
     if (info == NULL) {
         /* Null info means destroy the callback data. */
+        close(*fd);
         free(fd);
         return;
     }