X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/3194d1bb103c2d8db4f44feeced5e58ee2756658..e3ff8f35458a959c1879c0a4976701ed8dcfe651:/wp-admin/includes/class-wp-filesystem-ftpext.php?ds=sidebyside diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index 0a90b9cb..f337c733 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -116,11 +116,16 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { $tempfile = wp_tempnam($file); $temp = fopen($tempfile, 'w+'); - if ( ! $temp ) + if ( ! $temp ) { + unlink( $tempfile ); return false; + } - if ( ! @ftp_fget($this->link, $temp, $file, FTP_BINARY ) ) + if ( ! @ftp_fget( $this->link, $temp, $file, FTP_BINARY ) ) { + fclose( $temp ); + unlink( $tempfile ); return false; + } fseek( $temp, 0 ); // Skip back to the start of the file being written to $contents = ''; @@ -154,8 +159,11 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { public function put_contents($file, $contents, $mode = false ) { $tempfile = wp_tempnam($file); $temp = fopen( $tempfile, 'wb+' ); - if ( ! $temp ) + + if ( ! $temp ) { + unlink( $tempfile ); return false; + } mbstring_binary_safe_encoding();