fix C string leak, bug=18699, r=shaver

git-svn-id: svn://10.0.0.236/trunk@53951 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
beard%netscape.com
1999-11-19 02:14:23 +00:00
parent 03e774325c
commit fed38c19f8
2 changed files with 8 additions and 10 deletions

View File

@@ -1474,7 +1474,7 @@ nsComponentManagerImpl::RegisterComponentWithType(const nsCID &aClass,
const char *aType)
{
return RegisterComponentCommon(aClass, aClassName, aProgID,
nsCRT::strdup(aLocation),
aLocation,
aReplace, aPersist,
aType);
}
@@ -1490,8 +1490,8 @@ nsComponentManagerImpl::RegisterComponentSpec(const nsCID &aClass,
PRBool aReplace,
PRBool aPersist)
{
char *registryName;
nsresult rv = RegistryLocationForSpec(aLibrarySpec, &registryName);
nsXPIDLCString registryName;
nsresult rv = RegistryLocationForSpec(aLibrarySpec, getter_Copies(registryName));
if (NS_FAILED(rv))
return rv;
@@ -1499,7 +1499,6 @@ nsComponentManagerImpl::RegisterComponentSpec(const nsCID &aClass,
registryName,
aReplace, aPersist,
nativeComponentType);
nsAllocator::Free(registryName);
return rv;
}
@@ -1518,8 +1517,8 @@ nsComponentManagerImpl::RegisterComponentLib(const nsCID &aClass,
PRBool aReplace,
PRBool aPersist)
{
char *registryName;
nsresult rv = RegistryNameForLib(aDllName, &registryName);
nsXPIDLCString registryName;
nsresult rv = RegistryNameForLib(aDllName, getter_Copies(registryName));
if (NS_FAILED(rv))
return rv;
return RegisterComponentCommon(aClass, aClassName, aProgID, registryName,
@@ -1537,7 +1536,7 @@ nsresult
nsComponentManagerImpl::RegisterComponentCommon(const nsCID &aClass,
const char *aClassName,
const char *aProgID,
char *aRegistryName,
const char *aRegistryName,
PRBool aReplace,
PRBool aPersist,
const char *aType)
@@ -1639,8 +1638,6 @@ nsComponentManagerImpl::RegisterComponentCommon(const nsCID &aClass,
out:
if (NS_FAILED(rv)) {
if (aRegistryName)
nsAllocator::Free(aRegistryName);
if (newEntry)
delete newEntry;
}