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 <jjelen@redhat.com>
This commit is contained in:
Jakub Jelen 2021-11-23 09:34:25 +01:00 committed by NIIBE Yutaka
parent a9be9f4e6e
commit 940af3f052
1 changed files with 4 additions and 2 deletions

View File

@ -298,13 +298,15 @@ ldap_parse_extfilter (const char *string, int silent,
{ {
if (!silent) if (!silent)
log_info ("LDAP filter does not start with a left parentheses\n"); 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 (string[strlen(string)-1] != ')')
{ {
if (!silent) if (!silent)
log_info ("LDAP filter does not end with a right parentheses\n"); 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); filter = xtrystrdup (string);