krb5 commit: Fix fd leak in DIR ccache cursor function

Greg Hudson ghudson at MIT.EDU
Thu Feb 21 12:36:44 EST 2013


https://github.com/krb5/krb5/commit/c29d5f61af301aa8993b01ed0e3eb4f529d6862c
commit c29d5f61af301aa8993b01ed0e3eb4f529d6862c
Author: Greg Hudson <ghudson at mit.edu>
Date:   Thu Feb 21 12:36:07 2013 -0500

    Fix fd leak in DIR ccache cursor function
    
    If dcc_ptcursor_next reached the end of a directory, it called free()
    on the directory handle instead of closedir(), causing the directory
    fd to be leaked.  Call closedir() instead.
    
    ticket: 7573
    target_version: 1.11.1
    tags: pullup

 src/lib/krb5/ccache/cc_dir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/lib/krb5/ccache/cc_dir.c b/src/lib/krb5/ccache/cc_dir.c
index 1c97485..cee21ac 100644
--- a/src/lib/krb5/ccache/cc_dir.c
+++ b/src/lib/krb5/ccache/cc_dir.c
@@ -635,7 +635,7 @@ dcc_ptcursor_next(krb5_context context, krb5_cc_ptcursor cursor,
     }
 
     /* We exhausted the directory without finding a cache to yield. */
-    free(data->dir);
+    closedir(data->dir);
     data->dir = NULL;
     return 0;
 }


More information about the cvs-krb5 mailing list