From 88ffe0579726f7ba1985c9223e6005c581032757 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 25 Jun 2019 12:09:47 +0200 Subject: [PATCH] Fix bug #77124 This is a backport of 6fcae63f614d1ed4aaeaff7b13a7a4627b1f1312 to PHP 7.2. --- NEWS | 3 +++ ext/ftp/ftp.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index be4b60888f..d04dc6b79b 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ PHP NEWS . Fixed bug #78183 (finfo_file shows wrong mime-type for .tga file). (Joshua Westerheide) +- FTP: + . Fixed bug #77124 (FTP with SSL memory leak). (Nikita) + - PDO_Sqlite: . Fixed bug #78192 (SegFault when reuse statement after schema has changed). (Vincent Quatrevieux) diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 8f9f737678..28760349df 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -289,9 +289,10 @@ ftp_login(ftpbuf_t *ftp, const char *user, const size_t user_len, const char *pa SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_BOTH); ftp->ssl_handle = SSL_new(ctx); + SSL_CTX_free(ctx); + if (ftp->ssl_handle == NULL) { php_error_docref(NULL, E_WARNING, "failed to create the SSL handle"); - SSL_CTX_free(ctx); return 0; } -- 2.40.0