php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch always-free-context for FTP related Bug #77124

Patch version 2018-11-08 16:33 UTC

Return to Bug #77124 | Download this patch
Patch Revisions:

Developer: cmb@php.net

 ext/ftp/ftp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 578fd3f891..1d26f5ca2b 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -287,9 +287,9 @@ 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;
 		}
 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 08:01:28 2024 UTC