]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix fd leak in DIR ccache cursor function
authorGreg Hudson <ghudson@mit.edu>
Thu, 21 Feb 2013 17:36:07 +0000 (12:36 -0500)
committerGreg Hudson <ghudson@mit.edu>
Thu, 21 Feb 2013 17:36:07 +0000 (12:36 -0500)
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

index 1c97485aca3e8af1e407b769ba7a6690938d6385..cee21aca426b53df16dc0e38694b2a7e4b99cfc4 100644 (file)
@@ -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;
 }