Don't leak strings from <keygen>. Bug 398665, r=kaie, sr=jst, a=dbaron

git-svn-id: svn://10.0.0.236/trunk@237501 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2007-10-10 02:10:01 +00:00
parent 4ac99f461f
commit 154c45dfa1
4 changed files with 14 additions and 10 deletions

View File

@@ -349,6 +349,9 @@ nsKeygenFormProcessor::Init()
if (NS_FAILED(rv))
return rv;
// XXXbz this leaks the strings through shutdown. There's got to be
// a better way to do this! Of course that would involve having SOME
// shutdown code somewhere here.
nssComponent->GetPIPNSSBundleString("HighGrade", str);
SECKeySizeChoiceList[0].name = ToNewUnicode(str);
@@ -857,14 +860,13 @@ nsKeygenFormProcessor::ProcessValue(nsIDOMHTMLElement *aElement,
}
NS_METHOD nsKeygenFormProcessor::ProvideContent(const nsAString& aFormType,
nsVoidArray& aContent,
nsStringArray& aContent,
nsAString& aAttribute)
{
if (Compare(aFormType, NS_LITERAL_STRING("SELECT"),
nsCaseInsensitiveStringComparator()) == 0) {
for (SECKeySizeChoiceInfo* choice = SECKeySizeChoiceList; choice && choice->name; ++choice) {
nsString *str = new nsString(choice->name);
aContent.AppendElement(str);
aContent.AppendString(nsDependentString(choice->name));
}
aAttribute.AssignLiteral("-mozilla-keygen");
}