mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
fix possible memory leak when adding mime info objects to mime cache.
Bug 109130, r=law, sr=rpotts
This commit is contained in:
parent
1a03dbbd6b
commit
ad32eded51
@ -1645,6 +1645,8 @@ nsresult nsExternalHelperAppService::AddMimeInfoToCache(nsIMIMEInfo * aMIMEInfo)
|
||||
nsCStringKey key(mimeType);
|
||||
oldInfo = (nsIMIMEInfo*)mMimeInfoCache->Put(&key, aMIMEInfo);
|
||||
|
||||
// release the old info to prevent a leak
|
||||
NS_IF_RELEASE(oldInfo);
|
||||
// add a reference for the hash table entry....
|
||||
NS_ADDREF(aMIMEInfo);
|
||||
}
|
||||
@ -1659,6 +1661,7 @@ nsresult nsExternalHelperAppService::AddMimeInfoToCache(nsIMIMEInfo * aMIMEInfo)
|
||||
{
|
||||
nsCStringKey key(extensions[i]);
|
||||
oldInfo = (nsIMIMEInfo*) mMimeInfoCache->Put(&key, aMIMEInfo);
|
||||
NS_IF_RELEASE(oldInfo); // release the old info to prevent a leak
|
||||
NS_ADDREF(aMIMEInfo); // addref this new entry in the table
|
||||
nsMemory::Free( extensions[i] );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user