From 8b4d18493b22d7469048e9faf42bcc20750f2b2d Mon Sep 17 00:00:00 2001 From: Shugo Maeda Date: Thu, 14 Dec 2023 16:21:51 +0900 Subject: [PATCH] Fix connection leak when non-StandardError exceptions raise Thanks, @jeremyevans! https://github.com/ruby/net-ftp/pull/24#issuecomment-1855259150 --- lib/net/ftp.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index c33e867..efc2540 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -577,7 +577,7 @@ def transfercmd(cmd, rest_offset = nil) # :nodoc: if !resp.start_with?("1") raise FTPReplyError, resp end - rescue + rescue Exception conn&.close raise end