diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
index 8641d15..75cda97 100644
--- a/src/openvpn/ssl_verify.c
+++ b/src/openvpn/ssl_verify.c
@@ -1372,7 +1372,7 @@
             "could not create deferred auth control file",
             __func__);
         retval = OPENVPN_PLUGIN_FUNC_ERROR;
-        goto error;
+        goto done;
     }
 
     /* call command */
@@ -1415,7 +1415,6 @@
         platform_unlink(tmp_file);
     }
 
-error:
     if (!session->opt->auth_user_pass_verify_script_via_file)
     {
         setenv_del(session->opt->es, "password");
@@ -1487,6 +1486,10 @@
         tls_deauthenticate(multi);
     }
 done:
+    if (tmp_file)
+    {
+        platform_unlink(tmp_file);
+    }
     argv_free(&argv);
     gc_free(&gc);
 }
