diff --git a/network/module/nsNetStream.cpp b/network/module/nsNetStream.cpp index c27b1f8a6a68..1de3472c7ed6 100644 --- a/network/module/nsNetStream.cpp +++ b/network/module/nsNetStream.cpp @@ -556,7 +556,7 @@ nsresult nsBlockingStream::Write(const char *aBuf, PRInt32 *aWriteCount) { PRInt32 bytesFree; - nsresult rv; + nsresult rv = NS_OK; LockStream(); diff --git a/network/module/nsStubContext.cpp b/network/module/nsStubContext.cpp index 64ac5bc47a54..317abdc1f932 100644 --- a/network/module/nsStubContext.cpp +++ b/network/module/nsStubContext.cpp @@ -560,7 +560,11 @@ int stub_put_block(NET_StreamClass *stream, const char *buffer, int32 length) errorCode = pConn->pConsumer->OnDataAvailable(pConn->pURL, pConn->pNetStream, bytesWritten); } - return ((NS_OK == errorCode) && (bytesWritten == length)); + /* Abort the connection if an error occurred... */ + if (NS_FAILED(errorCode) || (bytesWritten != length)) { + return -1; + } + return 1; } unsigned int stub_is_write_ready(NET_StreamClass *stream)