warren's fix for the new/free mismatch undid kin's fix for the same problem. Also fix an off by one in the backwards 'for' loop. r=warren

This commit is contained in:
jband%netscape.com 2000-09-08 09:36:35 +00:00
Родитель 4b900e3e5a
Коммит 2730e37efd
2 изменённых файлов: 4 добавлений и 4 удалений

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

@ -672,7 +672,7 @@ nsJARChannel::GetContentType(char* *aContentType)
if (fileName != nsnull) { if (fileName != nsnull) {
PRInt32 len = nsCRT::strlen(fileName); PRInt32 len = nsCRT::strlen(fileName);
const char* ext = nsnull; const char* ext = nsnull;
for (PRInt32 i = len; i >= 0; i--) { for (PRInt32 i = len-1; i >= 0; i--) {
if (fileName[i] == '.') { if (fileName[i] == '.') {
ext = &fileName[i + 1]; ext = &fileName[i + 1];
break; break;
@ -688,7 +688,7 @@ nsJARChannel::GetContentType(char* *aContentType)
else else
rv = NS_ERROR_OUT_OF_MEMORY; rv = NS_ERROR_OUT_OF_MEMORY;
delete []fileName; nsCRT::free(fileName);
} }
else { else {
rv = NS_ERROR_FAILURE; rv = NS_ERROR_FAILURE;

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

@ -672,7 +672,7 @@ nsJARChannel::GetContentType(char* *aContentType)
if (fileName != nsnull) { if (fileName != nsnull) {
PRInt32 len = nsCRT::strlen(fileName); PRInt32 len = nsCRT::strlen(fileName);
const char* ext = nsnull; const char* ext = nsnull;
for (PRInt32 i = len; i >= 0; i--) { for (PRInt32 i = len-1; i >= 0; i--) {
if (fileName[i] == '.') { if (fileName[i] == '.') {
ext = &fileName[i + 1]; ext = &fileName[i + 1];
break; break;
@ -688,7 +688,7 @@ nsJARChannel::GetContentType(char* *aContentType)
else else
rv = NS_ERROR_OUT_OF_MEMORY; rv = NS_ERROR_OUT_OF_MEMORY;
delete []fileName; nsCRT::free(fileName);
} }
else { else {
rv = NS_ERROR_FAILURE; rv = NS_ERROR_FAILURE;