Bug 681407 - crash nsLocalFile::CopyMove, a=LegNeato
authorMichal Novotny <michal.novotny@gmail.com>
Wed, 19 Oct 2011 13:02:57 +0200
changeset 79137 4da434beb5377fe1a06800ff165cfb965cc04865
parent 79136 99db0336dcd19d7770c1e187a5e9a66a6d54a285
child 79138 5bf4059fa0e0e2a300f00adf682586891e876577
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersLegNeato
bugs681407
milestone9.0a2
Bug 681407 - crash nsLocalFile::CopyMove, a=LegNeato
xpcom/io/nsLocalFileOS2.cpp
xpcom/io/nsLocalFileWin.cpp
--- a/xpcom/io/nsLocalFileOS2.cpp
+++ b/xpcom/io/nsLocalFileOS2.cpp
@@ -1552,16 +1552,18 @@ nsLocalFile::CopyMove(nsIFile *aParentDi
             PRBool isWritable;
 
             target->IsWritable(&isWritable);
             if (!isWritable)
                 return NS_ERROR_FILE_ACCESS_DENIED;
 
             nsCOMPtr<nsISimpleEnumerator> targetIterator;
             rv = target->GetDirectoryEntries(getter_AddRefs(targetIterator));
+            if (NS_FAILED(rv))
+                return rv;
 
             PRBool more;
             targetIterator->HasMoreElements(&more);
             // return error if target directory is not empty
             if (more)
                 return NS_ERROR_FILE_DIR_NOT_EMPTY;
         }
 
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -1640,16 +1640,18 @@ nsLocalFile::CopyMove(nsIFile *aParentDi
             PRBool isWritable;
 
             target->IsWritable(&isWritable);
             if (!isWritable)
                 return NS_ERROR_FILE_ACCESS_DENIED;
 
             nsCOMPtr<nsISimpleEnumerator> targetIterator;
             rv = target->GetDirectoryEntries(getter_AddRefs(targetIterator));
+            if (NS_FAILED(rv))
+                return rv;
 
             PRBool more;
             targetIterator->HasMoreElements(&more);
             // return error if target directory is not empty
             if (more)
                 return NS_ERROR_FILE_DIR_NOT_EMPTY;
         }