From 940af3f05231dd85138fd3415c7bb7a974bec950 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 23 Nov 2021 09:34:25 +0100 Subject: dirmngr: Avoid memory leaks on errors * dirmngr/ldap-misc.c (ldap_parse_extfilter): Avoid direct return without freeing resources on errors. -- GnuPG-bug-id: 5393 Signed-off-by: Jakub Jelen --- dirmngr/ldap-misc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dirmngr/ldap-misc.c') diff --git a/dirmngr/ldap-misc.c b/dirmngr/ldap-misc.c index 42f9c7afc..90f1d1f3c 100644 --- a/dirmngr/ldap-misc.c +++ b/dirmngr/ldap-misc.c @@ -298,13 +298,15 @@ ldap_parse_extfilter (const char *string, int silent, { if (!silent) log_info ("LDAP filter does not start with a left parentheses\n"); - return gpg_error (GPG_ERR_SYNTAX); + err = gpg_error (GPG_ERR_SYNTAX); + goto leave; } if (string[strlen(string)-1] != ')') { if (!silent) log_info ("LDAP filter does not end with a right parentheses\n"); - return gpg_error (GPG_ERR_SYNTAX); + err = gpg_error (GPG_ERR_SYNTAX); + goto leave; } filter = xtrystrdup (string); -- cgit v1.2.3