Function sdb_entry_set_etypes allocates s->etypes->val and it is not deallocated in sdb_entry_free as it is done with s->session_etypes->val. Each user request for a ticket leaks this structure. Example of Valgrind report on this leak (on older version of Samba): > ==45048== 27,000 bytes in 2,250 blocks are definitely lost in loss record 286 of 318 > ==45048== at 0x48399A2: calloc (vg_replace_malloc.c:762) > ==45048== by 0x8D46DCF: sdb_entry_set_etypes (sdb.c:151) > ==45048== by 0x8D48A9D: samba_kdc_message2entry (db-glue.c:1435) > ==45048== by 0x8D4A512: samba_kdc_fetch_client (db-glue.c:2181) > ==45048== by 0x8D4A512: samba_kdc_fetch (db-glue.c:2772) > ==45048== by 0x8CDFA0E: hdb_samba4_fetch_kvno (hdb-samba4.c:260) > ==45048== by 0x8D00842: fetch_it (common.c:1508) > ==45048== by 0x8D00842: hdb_fetch_kvno (common.c:1623) > ==45048== by 0x8D2881E: _kdc_db_fetch (misc.c:191) > ==45048== by 0x8D1D75E: _kdc_as_rep (kerberos5.c:2183) > ==45048== by 0x8D28E86: kdc_as_req (process.c:254) > ==45048== by 0x8D29715: process_request (process.c:394) > ==45048== by 0x8D29953: krb5_kdc_process_krb5_request (process.c:459) > ==45048== by 0x8CD164C: kdc_process (kdc-heimdal.c:84)