dirmngr: Fix the cleanup zombies fix (685b782).

* dirmngr/ldap-wrapper.c (ldap_wrapper_thread): Do not close the
stdout reader after EOF from read_log_data.
* dirmngr/crlcache.c (crl_cache_reload_crl): Close the reader before
the next iteration.
--

I assumed that the log_fd also has a reader object but that reader
object is used for stdout and needs to be closed by the consumer.

The real bug with the non-released ldap_wrapper control objects was
that when looping over distribution points we did not closed the used
reader object before the next iteration.  Now, the test case had more
than one DP and thus we lost one reader object.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-06-18 13:34:48 +02:00
parent 010d26a85b
commit c97198371b
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 6 additions and 9 deletions

View File

@ -2525,6 +2525,9 @@ crl_cache_reload_crl (ctrl_t ctrl, ksba_cert_t cert)
issuername_uri = ksba_name_get_uri (issuername, 0);
ksba_name_release (issuername); issuername = NULL;
/* Close the reader. */
crl_close_reader (reader);
reader = NULL;
}
if (gpg_err_code (err) == GPG_ERR_EOF)
err = 0;
@ -2535,11 +2538,8 @@ crl_cache_reload_crl (ctrl_t ctrl, ksba_cert_t cert)
if (opt.verbose)
log_info ("no distribution point - trying issuer name\n");
if (reader)
{
crl_close_reader (reader);
reader = NULL;
}
crl_close_reader (reader);
reader = NULL;
issuer = ksba_cert_get_issuer (cert, 0);
if (!issuer)
@ -2571,8 +2571,7 @@ crl_cache_reload_crl (ctrl_t ctrl, ksba_cert_t cert)
}
leave:
if (reader)
crl_close_reader (reader);
crl_close_reader (reader);
xfree (distpoint_uri);
xfree (issuername_uri);
ksba_name_release (distpoint);

View File

@ -325,8 +325,6 @@ ldap_wrapper_thread (void *dummy)
{
if (read_log_data (ctx))
{
ksba_reader_release (ctx->reader);
ctx->reader = NULL;
SAFE_CLOSE (ctx->log_fd);
any_action = 1;
}