fix bug 13068
git-svn-id: svn://10.0.0.236/trunk@46034 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -322,18 +322,17 @@ nsresult
|
||||
cookie_Put(nsOutputFileStream strm, const nsString& aLine)
|
||||
{
|
||||
/* allocate a buffer from the heap */
|
||||
char * cp = new char[aLine.Length() + 1];
|
||||
char * cp = aLine.ToNewCString();
|
||||
if (! cp) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
aLine.ToCString(cp, aLine.Length() + 1);
|
||||
|
||||
/* output each character */
|
||||
char* p = cp;
|
||||
while (*p) {
|
||||
strm.put(*(p++));
|
||||
}
|
||||
delete[] cp;
|
||||
nsCRT::free(cp);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1444,13 +1444,11 @@ PRInt32
|
||||
wallet_PutLine(nsOutputFileStream strm, const nsString& aLine, PRBool obscure)
|
||||
{
|
||||
/* allocate a buffer from the heap */
|
||||
char * cp = new char[aLine.Length() + 1];
|
||||
char * cp = aLine.ToNewCString();
|
||||
if (! cp) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aLine.ToCString(cp, aLine.Length() + 1);
|
||||
|
||||
/* output each character */
|
||||
char* p = cp;
|
||||
while (*p) {
|
||||
@@ -1458,7 +1456,7 @@ wallet_PutLine(nsOutputFileStream strm, const nsString& aLine, PRBool obscure)
|
||||
}
|
||||
strm.put('\n'^(obscure ? Wallet_GetKey() : (char)0));
|
||||
|
||||
delete[] cp;
|
||||
nsCRT::free(cp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user