check ConvertFromUnicode() result and handle error - #66958, sr=sspitzer, sr=bienvenu

git-svn-id: svn://10.0.0.236/trunk@86056 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
taka%netscape.com
2001-02-02 08:13:12 +00:00
parent 275ac49856
commit 73bae8fde6

View File

@@ -581,8 +581,8 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, PRBool real
useQuotes = !reallyDredd ||
(nsAutoString(convertedValue).FindChar((PRUnichar)' ') != -1);
// now convert to char* and escape quoted_specials
ConvertFromUnicode(nsAutoString(convertedValue), nsAutoString(destCharset), &value);
if (value)
nsresult rv = ConvertFromUnicode(nsAutoString(destCharset), nsAutoString(convertedValue), &value);
if (NS_SUCCEEDED(rv) && value)
{
char *oldValue = value;
// max escaped length is one extra character for every character in the cmd.
@@ -602,9 +602,11 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, PRBool real
*p = '\0';
value = nsCRT::strdup(newValue); // realloc down to smaller size
nsCRT::free(newValue);
nsCRT::free(oldValue);
}
nsCRT::free(oldValue);
}
else
value = nsCRT::strdup("");
nsCRT::free(convertedValue);
valueWasAllocated = PR_TRUE;