fix leak caused by nsLocalFile::Clone() where we were copying the refcnt to the new object - bug 124497

this ends up being more of a performance win than anyting on Unix and OS/2
r=mkaply, dbaron, sr=darin, a=asa
This commit is contained in:
alecf@netscape.com
2002-03-20 00:25:21 +00:00
parent 1feece8b06
commit 038af60ff3
2 changed files with 12 additions and 17 deletions

View File

@@ -243,13 +243,11 @@ nsLocalFile::Clone(nsIFile **file)
CHECK_mPath();
NS_ENSURE_ARG(file);
nsCOMPtr<nsILocalFile> localFile = new nsLocalFile();
nsLocalFile *localFile = new nsLocalFile(*this);
if (!localFile)
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = localFile->InitWithPath(mPath);
if (NS_FAILED(rv))
return rv;
localFile->mRefCnt = 0;
*file = localFile;
NS_ADDREF(*file);