From 2787833bb7c1d17d5dfab029406502be020836e0 Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Wed, 25 Oct 2006 16:00:02 +0000 Subject: [PATCH] Bug 357877 nsFileChannel::OpenContentStream leaks when nsFileUploadContentStream::IsInitialized fails patch by Ryan Jones r+sr=biesi git-svn-id: svn://10.0.0.236/trunk@214110 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/netwerk/protocol/file/src/nsFileChannel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp b/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp index 002625ee9a2..7513f44703e 100644 --- a/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp +++ b/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp @@ -49,6 +49,7 @@ #include "nsNetSegmentUtils.h" #include "nsProxyRelease.h" #include "nsAutoPtr.h" +#include "nsStandardURL.h" #include "nsIFileURL.h" #include "nsIMIMEService.h" @@ -332,8 +333,10 @@ nsFileChannel::OpenContentStream(PRBool async, nsIInputStream **result) nsFileUploadContentStream *uploadStream = new nsFileUploadContentStream(async, fileStream, mUploadStream, mUploadLength, this); - if (!uploadStream || !uploadStream->IsInitialized()) + if (!uploadStream || !uploadStream->IsInitialized()) { + delete uploadStream; return NS_ERROR_OUT_OF_MEMORY; + } stream = uploadStream; SetContentLength64(0);