]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc: call krb5_free_keyblock_contents() in free_sdb_key()
authorStefan Metzmacher <metze@samba.org>
Fri, 11 Feb 2022 19:56:17 +0000 (20:56 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 24 Mar 2022 09:19:33 +0000 (09:19 +0000)
This is much clearer than doing it in sdb_free_entry() already.
It also simplifies the next cleanups.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/kdc/sdb.c

index 7ccd26578fa2ad648521b470fa0e957fd200d15d..5828c653f64b983796fcd5960fd10115be46fec9 100644 (file)
 
 void sdb_free_entry(struct sdb_entry_ex *ent)
 {
-       struct sdb_key *k;
-       size_t i;
-
-       for (i = 0; i < ent->entry.keys.len; i++) {
-               k = &ent->entry.keys.val[i];
-
-               /*
-                * Passing NULL as the Kerberos context is intentional here, as
-                * both Heimdal and MIT libraries don't use the context when
-                * clearing the keyblocks.
-                */
-               krb5_free_keyblock_contents(NULL, &k->key);
-       }
-
        free_sdb_entry(&ent->entry);
        ZERO_STRUCTP(ent);
 }
@@ -52,7 +38,12 @@ static void free_sdb_key(struct sdb_key *k)
                return;
        }
 
-       /* keyblock not alloced */
+       /*
+        * Passing NULL as the Kerberos context is intentional here, as
+        * both Heimdal and MIT libraries don't use the context when
+        * clearing the keyblocks.
+        */
+       krb5_free_keyblock_contents(NULL, &k->key);
 
        if (k->salt) {
                smb_krb5_free_data_contents(NULL, &k->salt->salt);