krb5 commit: Fix test_check_allowed_to_delegate() leak for real

Greg Hudson ghudson at mit.edu
Fri Jun 3 11:54:54 EDT 2016


https://github.com/krb5/krb5/commit/b5a9fbe928ffc311a3abda562ef909cd7555b282
commit b5a9fbe928ffc311a3abda562ef909cd7555b282
Author: Greg Hudson <ghudson at mit.edu>
Date:   Thu Jun 2 18:21:41 2016 -0400

    Fix test_check_allowed_to_delegate() leak for real
    
    Remove the conditional return from so that sprinc and tprinc are
    always freed.  Reported by Will Fiveash.
    
    ticket: 8426

 src/plugins/kdb/test/kdb_test.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/plugins/kdb/test/kdb_test.c b/src/plugins/kdb/test/kdb_test.c
index b752c0e..776dda3 100644
--- a/src/plugins/kdb/test/kdb_test.c
+++ b/src/plugins/kdb/test/kdb_test.c
@@ -489,17 +489,17 @@ test_check_allowed_to_delegate(krb5_context context,
                                   KRB5_PRINCIPAL_UNPARSE_NO_REALM, &tprinc));
     set_names(h, "delegation", sprinc, NULL);
     ret = profile_get_values(h->profile, h->names, &values);
-    if (ret == PROF_NO_RELATION)
-        return KRB5KDC_ERR_POLICY;
-    for (v = values; *v != NULL; v++) {
-        if (strcmp(*v, tprinc) == 0) {
-            found = TRUE;
-            break;
+    if (ret != PROF_NO_RELATION) {
+        for (v = values; *v != NULL; v++) {
+            if (strcmp(*v, tprinc) == 0) {
+                found = TRUE;
+                break;
+            }
         }
+        profile_free_list(values);
     }
     krb5_free_unparsed_name(context, sprinc);
     krb5_free_unparsed_name(context, tprinc);
-    profile_free_list(values);
     return found ? 0 : KRB5KDC_ERR_POLICY;
 }
 


More information about the cvs-krb5 mailing list