Fix bug 82370, leak in disk cache. r=dbaron, sr=darin, a=asa.

git-svn-id: svn://10.0.0.236/trunk@95922 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gordon%netscape.com
2001-05-25 18:47:53 +00:00
parent 6f9f66996a
commit 42912e8176
3 changed files with 16 additions and 8 deletions

View File

@@ -562,6 +562,8 @@ nsDiskCacheMap::ReadDiskCacheEntry(nsDiskCacheRecord * record, nsDiskCacheEntry
PRFileDesc * fd = nsnull;
*result = nsnull;
if (!record->MetaLocationInitialized()) return NS_ERROR_NOT_AVAILABLE;
if (metaFile == 0) { // entry/metadata stored in separate file
// open and read the file
nsCOMPtr<nsILocalFile> file;
@@ -614,7 +616,7 @@ nsDiskCacheMap::ReadDiskCacheEntry(nsDiskCacheRecord * record, nsDiskCacheEntry
exit:
// XXX auto ptr would be nice
if (fd) (void) PR_Close(fd);
delete diskEntry;
delete [] (char *)diskEntry;
return rv;
}
@@ -657,7 +659,7 @@ nsDiskCacheMap::WriteDiskCacheEntry(nsDiskCacheBinding * binding)
"generations out of sync");
} else {
rv = DeleteStorage(&binding->mRecord, nsDiskCache::kMetaData);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) goto exit;
}
}
@@ -719,7 +721,7 @@ nsDiskCacheMap::WriteDiskCacheEntry(nsDiskCacheBinding * binding)
}
exit:
delete [] (char *)diskEntry;
return rv;
}