Fix bug # 120712: memory leak fix. Forced to use nsAutoString as CBufDescriptor doesn't guarantee zero termination. Patch from ajschultz@eos.ncsu.edu. r=rjc sr=jag

This commit is contained in:
rjc%netscape.com 2002-10-04 02:25:03 +00:00
Родитель aae6d276d3
Коммит 56003e0b76
1 изменённых файлов: 4 добавлений и 4 удалений

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

@ -5347,10 +5347,10 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent,
resultItemEnd += resultItemEndStr.Length();
}
// use a CBufDescriptor so that "htmlResults" data isn't copied
CBufDescriptor htmlResultDecriptor( &htmlPage[resultItemStart], PR_TRUE,
resultItemEnd - resultItemStart - 1);
nsAutoString resultItem(htmlResultDecriptor);
// forced to use an nsAutoString (which copies)
// as CBufDescriptor doesn't guarantee null terminator
nsAutoString resultItem(&htmlPage[resultItemStart],
resultItemEnd - resultItemStart - 1);
if (resultItem.IsEmpty()) break;