Bug 1409329 - NS_NewBufferedOutputStream should take the ownership of the outputStream, r=smaug

This commit is contained in:
Andrea Marchesini
2017-10-24 14:38:23 +02:00
parent af5a4eaa1d
commit c9ad4ef15f
13 changed files with 38 additions and 58 deletions

View File

@@ -278,8 +278,10 @@ VariableLengthPrefixSet::StoreToFile(nsIFile* aFile)
}
// Convert to buffered stream
nsCOMPtr<nsIOutputStream> out =
NS_BufferOutputStream(localOutFile, std::min(fileSize, MAX_BUFFER_SIZE));
nsCOMPtr<nsIOutputStream> out;
rv = NS_NewBufferedOutputStream(getter_AddRefs(out), localOutFile.forget(),
std::min(fileSize, MAX_BUFFER_SIZE));
NS_ENSURE_SUCCESS(rv, rv);
rv = mFixedPrefixSet->WritePrefixes(out);
NS_ENSURE_SUCCESS(rv, rv);