diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index 38536a0ea9..bba4608a8c 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -116,12 +116,17 @@ 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 = ''; diff --git a/wp-includes/version.php b/wp-includes/version.php index d87e43d345..2f40b5747f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-35776'; +$wp_version = '4.5-alpha-35777'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.