agent: Fix an error path of agent_get_confirmation.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 6 Aug 2019 20:38:30 +0000 (05:38 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 6 Aug 2019 20:38:30 +0000 (05:38 +0900)
* agent/call-pinentry.c (agent_get_confirmation): Make sure
unlock_pinentry is always called.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
agent/call-pinentry.c

index a895a8b..34eb77c 100644 (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;
-
-    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);
+    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);
 
-    watch_sock_end (&sock_watched, &thread);
+        watch_sock_end (&sock_watched, &thread);
+      }
 
     return unlock_pinentry (ctrl, rc);
   }