summaryrefslogtreecommitdiffstats
path: root/dirmngr/ldap-misc.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2021-11-23 09:34:25 +0100
committerNIIBE Yutaka <gniibe@fsij.org>2021-11-24 02:50:33 +0100
commit940af3f05231dd85138fd3415c7bb7a974bec950 (patch)
tree7e0604e060633c352378c405e95b3ace01ded544 /dirmngr/ldap-misc.c
parentgpg: Fix format_keyid. (diff)
downloadgnupg2-940af3f05231dd85138fd3415c7bb7a974bec950.tar.xz
gnupg2-940af3f05231dd85138fd3415c7bb7a974bec950.zip
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>
Diffstat (limited to 'dirmngr/ldap-misc.c')
-rw-r--r--dirmngr/ldap-misc.c6
1 files changed, 4 insertions, 2 deletions
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);