Fix leak of nsAtom, some string clean-up, r=gagan, sr=jst

This commit is contained in:
disttsc%bart.nl 2001-03-22 09:53:30 +00:00
Родитель f24ba3784c
Коммит 3d99ee79c9
1 изменённых файлов: 3 добавлений и 3 удалений

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

@ -3383,7 +3383,7 @@ NS_IMETHODIMP nsDocShell::AddHeadersToChannel(nsIInputStream *aHeadersData,
nsCAutoString headerValue; nsCAutoString headerValue;
PRInt32 crlf = 0; PRInt32 crlf = 0;
PRInt32 colon = 0; PRInt32 colon = 0;
nsIAtom *headerAtom; nsCOMPtr<nsIAtom> headerAtom;
// //
// Suck all the data out of the nsIInputStream into a char * buffer. // Suck all the data out of the nsIInputStream into a char * buffer.
@ -3430,7 +3430,7 @@ NS_IMETHODIMP nsDocShell::AddHeadersToChannel(nsIInputStream *aHeadersData,
oneHeader.Left(headerName, colon); oneHeader.Left(headerName, colon);
colon++; colon++;
oneHeader.Mid(headerValue, colon, oneHeader.Length() - colon); oneHeader.Mid(headerValue, colon, oneHeader.Length() - colon);
headerAtom = NS_NewAtom((const char *) headerName); headerAtom = dont_AddRef(NS_NewAtom(headerName.get()));
if (!headerAtom) { if (!headerAtom) {
rv = NS_ERROR_NULL_POINTER; rv = NS_ERROR_NULL_POINTER;
goto AHTC_CLEANUP; goto AHTC_CLEANUP;
@ -3440,7 +3440,7 @@ NS_IMETHODIMP nsDocShell::AddHeadersToChannel(nsIInputStream *aHeadersData,
// FINALLY: we can set the header! // FINALLY: we can set the header!
// //
rv =aChannel->SetRequestHeader(headerAtom, (const char *) headerValue); rv =aChannel->SetRequestHeader(headerAtom, headerValue.get());
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
rv = NS_ERROR_NULL_POINTER; rv = NS_ERROR_NULL_POINTER;
goto AHTC_CLEANUP; goto AHTC_CLEANUP;