Mercurial > dovecot > core-2.2
changeset 22620:71665d0c1382
auth: Fix %{ldap_dn} not to leak memory
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 19 Oct 2017 15:39:28 +0300 |
parents | a597f13d9a05 |
children | a91a473c65f7 |
files | src/auth/db-ldap.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/db-ldap.c Wed Oct 11 16:33:57 2017 -0400 +++ b/src/auth/db-ldap.c Thu Oct 19 15:39:28 2017 +0300 @@ -1660,7 +1660,10 @@ db_ldap_field_dn_expand(const char *data ATTR_UNUSED, void *context ATTR_UNUSED) { struct db_ldap_result_iterate_context *ctx = context; - return ldap_get_dn(ctx->ld, ctx->ldap_msg); + char *dn = ldap_get_dn(ctx->ld, ctx->ldap_msg); + const char *dn_dup = t_strdup(dn); + ldap_memfree(dn); + return dn_dup; } static struct var_expand_func_table ldap_var_funcs_table[] = {