]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix test_check_allowed_to_delegate() leak for real 462/head
authorGreg Hudson <ghudson@mit.edu>
Thu, 2 Jun 2016 22:21:41 +0000 (18:21 -0400)
committerGreg Hudson <ghudson@mit.edu>
Fri, 3 Jun 2016 15:37:07 +0000 (11:37 -0400)
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

index b752c0e093cd4a89e9abb884079c07ad1cd0238d..776dda388c243b90f8f442f9ba9bab04c3d82488 100644 (file)
@@ -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;
 }