]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix rare leak in krb5_cccol_have_content()
authorGreg Hudson <ghudson@mit.edu>
Fri, 21 Oct 2016 06:06:18 +0000 (02:06 -0400)
committerGreg Hudson <ghudson@mit.edu>
Mon, 24 Oct 2016 15:41:18 +0000 (11:41 -0400)
If krb5_cc_start_seq_get() fails inside the loop, close the current
credential cache before continuing to the next one.  Reported by Todd
Lipcon.

ticket: 8509
target_version: 1.15-next
target_version: 1.14-next
tags: pullup

src/lib/krb5/ccache/cccursor.c

index 281f1280c4f45d7f34d41dcc64e90dae5f7c8dce..c31a3f5f0b874e9cebf41253a4664059fffbe672 100644 (file)
@@ -255,8 +255,10 @@ krb5_cccol_have_content(krb5_context context)
 
         ret = krb5_cc_start_seq_get(context, cache, &cache_cursor);
         save_first_error(context, ret, &errsave);
-        if (ret)
+        if (ret) {
+            krb5_cc_close(context, cache);
             continue;
+        }
         while (!found) {
             ret = krb5_cc_next_cred(context, cache, &cache_cursor, &creds);
             save_first_error(context, ret, &errsave);