From 2b616984871dbe7f1cd045c3c4ae728f17fa84f8 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sat, 18 Apr 2009 18:26:17 -0400 Subject: [PATCH] Minor cleanup. Removed cleanup_crypto_handler(). --- src/pinentry.c | 2 +- src/pwmd.c | 42 +++++++++++++++++------------------------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/pinentry.c b/src/pinentry.c index a8b50d6a..5de35fa6 100644 --- a/src/pinentry.c +++ b/src/pinentry.c @@ -505,7 +505,7 @@ gpg_error_t pinentry_fork(assuan_context_t ctx) close(p[0]); free_client_list(); - if (pin->timeout > 0 && client->pinentry->which == PINENTRY_OPEN) { + if (pin->timeout > 0 && pin->which == PINENTRY_OPEN) { /* * Send the pid of the pinentry process back to pwmd so it can * handle the pinentry timeout properly. diff --git a/src/pwmd.c b/src/pwmd.c index 74f96048..93679107 100644 --- a/src/pwmd.c +++ b/src/pwmd.c @@ -353,29 +353,6 @@ static void xml_error_cb(void *data, xmlErrorPtr e) xmlCopyError(e, client->xml_error); } -static void cleanup_crypto_handler(void *arg) -{ - struct client_crypto_s **a = (struct client_crypto_s **)arg; - struct client_crypto_s *cr = *a; - - if (cr->fh) { - if (cr->fh->fd != -1 || - (cmdline == TRUE && cr->fh->fd != STDOUT_FILENO)) - close(cr->fh->fd); - - if (cr->fh->doc) - gcry_free(cr->fh->doc); - - g_free(cr->fh); - } - - if (cr->gh) - gcry_cipher_close(cr->gh); - - g_free(cr); - *a = NULL; -} - void cleanup_crypto(struct client_crypto_s **c) { struct client_crypto_s *cr = *c; @@ -401,7 +378,22 @@ void cleanup_crypto(struct client_crypto_s **c) if (cr->outbuf) gcry_free(cr->outbuf); - cleanup_crypto_handler(c); + if (cr->fh) { + if (cr->fh->fd != -1 || + (cmdline == TRUE && cr->fh->fd != STDOUT_FILENO)) + close(cr->fh->fd); + + if (cr->fh->doc) + gcry_free(cr->fh->doc); + + g_free(cr->fh); + } + + if (cr->gh) + gcry_cipher_close(cr->gh); + + g_free(cr); + *c = NULL; } /* @@ -1647,7 +1639,7 @@ done: } /* - * Called from pinentry_fork() in the child process. + * Only called from pinentry_fork() in the child process. */ void free_client_list() { -- 2.11.4.GIT