diff --git a/netwerk/protocol/file/nsFileChannel.cpp b/netwerk/protocol/file/nsFileChannel.cpp index 93840f5755c4..e2ed0b7362ad 100644 --- a/netwerk/protocol/file/nsFileChannel.cpp +++ b/netwerk/protocol/file/nsFileChannel.cpp @@ -178,20 +178,14 @@ public: uint32_t count, nsIEventTarget *target); private: + virtual ~nsFileUploadContentStream() {} + void OnCopyComplete(); nsRefPtr mCopyEvent; nsCOMPtr mSink; }; -namespace mozilla { -template<> -struct HasDangerousPublicDestructor -{ - static const bool value = true; -}; -} - NS_IMPL_ISUPPORTS_INHERITED0(nsFileUploadContentStream, nsBaseContentStream) @@ -365,14 +359,13 @@ nsFileChannel::OpenContentStream(bool async, nsIInputStream **result, if (NS_FAILED(rv)) return rv; - nsFileUploadContentStream *uploadStream = + nsRefPtr uploadStream = new nsFileUploadContentStream(async, fileStream, mUploadStream, mUploadLength, this); if (!uploadStream || !uploadStream->IsInitialized()) { - delete uploadStream; return NS_ERROR_OUT_OF_MEMORY; } - stream = uploadStream; + stream = uploadStream.forget(); mContentLength = 0;