agent: Fix an error path of agent_get_confirmation.

* agent/call-pinentry.c (agent_get_confirmation): Make sure
unlock_pinentry is always called.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2019-08-07 05:38:30 +09:00
parent f588dd8d17
commit bb82ad018a
1 changed files with 9 additions and 8 deletions

View File

@ -1481,15 +1481,16 @@ agent_get_confirmation (ctrl_t ctrl,
npth_t thread;
rc = watch_sock_start (&sock_watched, &thread);
if (rc)
return rc;
if (!rc)
{
rc = assuan_transact (entry_ctx, "CONFIRM",
NULL, NULL, NULL, NULL, NULL, NULL);
if (rc && gpg_err_source (rc)
&& gpg_err_code (rc) == GPG_ERR_ASS_CANCELED)
rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_CANCELED);
rc = assuan_transact (entry_ctx, "CONFIRM",
NULL, NULL, NULL, NULL, NULL, NULL);
if (rc && gpg_err_source (rc) && gpg_err_code (rc) == GPG_ERR_ASS_CANCELED)
rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_CANCELED);
watch_sock_end (&sock_watched, &thread);
watch_sock_end (&sock_watched, &thread);
}
return unlock_pinentry (ctrl, rc);
}