From: Ivan Korytov Date: Fri, 21 Feb 2025 11:22:41 +0000 (+0300) Subject: s4:kdc: Fix memory leak of padata_value X-Git-Tag: tevent-0.17.0~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ea84959a720d509f6a8acdde4d0f72d450cfb087;p=thirdparty%2Fsamba.git s4:kdc: Fix memory leak of padata_value md.padata_value is not needed even if no error occurred. kdc_request_add_encrypted_padata copies data from it to newly allocated r->ek.encrypted_pa_data. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15813 Signed-off-by: Ivan Korytov Reviewed-by: Jennifer Sutton Reviewed-by: Douglas Bagnall --- diff --git a/source4/kdc/wdc-samba4.c b/source4/kdc/wdc-samba4.c index 0741c0878af..9d464a70560 100644 --- a/source4/kdc/wdc-samba4.c +++ b/source4/kdc/wdc-samba4.c @@ -737,12 +737,9 @@ static krb5_error_code samba_wdc_finalize_reply(void *priv, md.padata_type = KRB5_PADATA_SUPPORTED_ETYPES; ret = kdc_request_add_encrypted_padata(r, &md); + krb5_data_free(&md.padata_value); if (ret != 0) { - /* - * So we do not leak the allocated - * memory on md in the error case - */ - krb5_data_free(&md.padata_value); + return ret; } }