#112973, we leak the whole file on upload (of, for example a patch in bugzilla).

r=bzbarsky, sr=attinasi
This commit is contained in:
hwaara%chello.se 2001-12-17 22:21:38 +00:00
Родитель 073a7c9d91
Коммит 1d2ac8f02c
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -1063,15 +1063,18 @@ nsFormSubmitter::ProcessAsMultipart(nsIForm* form,
}
// Print file contents
PRInt32 size = 1;
char* readbuffer = nsnull;
while (1) {
char* readbuffer = nsnull;
// Read() mallocs if readbuffer is null
rv = contentFile->Read(&readbuffer, BUFSIZE, &size);
if (NS_FAILED(rv) || 0 >= size) break;
wantbytes = size;
rv = outStream->Write(readbuffer, wantbytes, &gotbytes);
if (NS_FAILED(rv) || (wantbytes != gotbytes)) break;
}
nsMemory::Free(readbuffer);
NS_RELEASE(contentFile);
if (NS_FAILED(rv)) break;
// Print CRLF after file
wantbytes = PL_strlen(CRLF);
rv = outStream->Write(CRLF, wantbytes, &gotbytes);