From bffc6bc753873c4eb87fed9883ae2c309ec0a96c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 13 Jul 2014 13:53:06 +0000 Subject: [PATCH] Fix socket leaks in wxFTP if starting up/downloading fails. Add the missing delete statements. Closes #2250. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76905 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/ftp.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index 0973522a46..dc159f5571 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -769,7 +769,11 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path) wxString tmp_str = wxT("RETR ") + wxURI::Unescape(path); if ( !CheckCommand(tmp_str, '1') ) + { + delete sock; + return NULL; + } sock = AcceptIfActive(sock); if ( !sock ) @@ -800,7 +804,11 @@ wxOutputStream *wxFTP::GetOutputStream(const wxString& path) wxString tmp_str = wxT("STOR ") + path; if ( !CheckCommand(tmp_str, '1') ) + { + delete sock; + return NULL; + } sock = AcceptIfActive(sock);