From 7f902798a7f43ea84fb7757ea6b917a4717f99e0 Mon Sep 17 00:00:00 2001 From: Swen Schillig Date: Wed, 21 Nov 2018 12:05:24 +0100 Subject: [PATCH] s3: Free principal if smb_krb5_principal_get_realm() fails If smb_krb5_principal_get_realm() fails, procesing is aborted and resources have to be free'd. In this context free'ing the principal was missing. Signed-off-by: Swen Schillig Reviewed-by: Andreas Schneider Reviewed-by: Ralph Boehme --- source3/libads/krb5_setpw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libads/krb5_setpw.c b/source3/libads/krb5_setpw.c index 8f9098853b9..94dd8eefc92 100644 --- a/source3/libads/krb5_setpw.c +++ b/source3/libads/krb5_setpw.c @@ -221,6 +221,7 @@ static ADS_STATUS ads_krb5_chg_password(const char *kdc_host, /* We have to obtain an INITIAL changepw ticket for changing password */ if (asprintf(&chpw_princ, "kadmin/changepw@%s", realm) == -1) { + krb5_free_principal(context, princ); krb5_get_init_creds_opt_free(context, opts); smb_krb5_free_addresses(context, addr); krb5_free_context(context); -- 2.34.1