Wordpress 4.6
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-filesystem-ftpsockets.php
index fe74d33c1d4d1d9145eeed5d3f174d48e09af45c..ff0b882414be3c22453a6eed50adb7fb1711039e 100644 (file)
@@ -121,8 +121,10 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
 
                $temp = wp_tempnam( $file );
 
-               if ( ! $temphandle = fopen($temp, 'w+') )
+               if ( ! $temphandle = fopen( $temp, 'w+' ) ) {
+                       unlink( $temp );
                        return false;
+               }
 
                mbstring_binary_safe_encoding();