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

This commit is contained in:
Andrea Marchesini
2017-10-17 20:38:05 +02:00
parent 9934434022
commit 47c73656be
13 changed files with 36 additions and 57 deletions

View File

@@ -275,8 +275,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);