The branch, master has been updated
       via  b36c49e43e9 s4:kdc:sdb_to_hdb: Fix CID 1665466
      from  e5b00b6511b passdb: Fixing CID 1509029 for time_t in DEBUG statement

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b36c49e43e92552425523deb68d355fc8c3a88fe
Author: Gary Lockyer <g...@catalyst.net.nz>
Date:   Mon Sep 22 09:04:02 2025 +1200

    s4:kdc:sdb_to_hdb: Fix CID 1665466
    
    Fix:
    *** CID 1665466:         Resource leaks  (RESOURCE_LEAK)
    /source4/kdc/sdb_to_hdb.c: 482             in sdb_entry_to_hdb_entry()
    476         }
    477
    478         h->context = ske;
    479         if (ske != NULL) {
    480                 ske->kdc_entry = h;
    481         }
    >>>     CID 1665466:         Resource leaks  (RESOURCE_LEAK)
    >>>     Variable "kt" going out of scope leaks the storage "kt.val" points 
to.
    482         return 0;
    483     error:
    484         free_hdb_entry(h);
    485         return rc;
    
    This is almost certainly a false positive as when kt.len == 0, kt.val will 
be
    NULL. But changing the condition to kt.val != NULL, will not do any harm.
    
    Signed-off-by: Gary Lockyer <g...@catalyst.net.nz>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Anoop C S <anoo...@samba.org>
    
    Autobuild-User(master): Anoop C S <anoo...@samba.org>
    Autobuild-Date(master): Thu Sep 25 07:13:28 UTC 2025 on atb-devel-224

-----------------------------------------------------------------------

Summary of changes:
 source4/kdc/sdb_to_hdb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/kdc/sdb_to_hdb.c b/source4/kdc/sdb_to_hdb.c
index ef02ce5be2a..83e5547b8a1 100644
--- a/source4/kdc/sdb_to_hdb.c
+++ b/source4/kdc/sdb_to_hdb.c
@@ -463,16 +463,16 @@ int sdb_entry_to_hdb_entry(krb5_context context,
        if (rc != 0) {
                goto error;
        }
-       if (kt.len > 0) {
+       if (kt.val != NULL && kt.len != 0) {
                HDB_extension ext = {};
                ext.mandatory = FALSE;
                ext.data.element = choice_HDB_extension_data_key_trust;
                ext.data.u.key_trust = kt;
                rc = hdb_replace_extension(context, h, &ext);
-               free_HDB_Ext_KeyTrust(&kt);
-               if (rc != 0) {
-                       goto error;
-               }
+       }
+       free_HDB_Ext_KeyTrust(&kt);
+       if (rc != 0) {
+               goto error;
        }
 
        h->context = ske;


-- 
Samba Shared Repository

Reply via email to