PR_FREEIF(dstPtr); return convertedString;
return dstPtr;
CreateUtf7ConvertedStringFromUnicode(const PRUnichar * aSourceString){  nsresult res;  char *dstPtr = nsnull;  PRInt32 dstLength = 0;  char *convertedString = NULL;    NS_WITH_SERVICE(nsICharsetConverterManager, ccm, kCharsetConverterManagerCID, &res);   if(NS_SUCCEEDED(res) && (nsnull != ccm))  {    nsString aCharset("x-imap4-modified-utf7");    PRInt32 unicharLength;      // convert from 8 bit ascii string to modified utf7      nsString unicodeStr(aSourceString);      nsIUnicodeEncoder* encoder = nsnull;      aCharset.SetString("x-imap4-modified-utf7");      res = ccm->GetUnicodeEncoder(&aCharset, &encoder);      if(NS_SUCCEEDED(res) && (nsnull != encoder))       {        res = encoder->GetMaxLength(unicodeStr.GetUnicode(), unicodeStr.Length(), &dstLength);        // allocale an output buffer        dstPtr = (char *) PR_CALLOC(dstLength + 1);        unicharLength = unicodeStr.Length();        if (dstPtr == nsnull)         {          res = NS_ERROR_OUT_OF_MEMORY;        }        else         {          res = encoder->Convert(unicodeStr.GetUnicode(), &unicharLength, dstPtr, &dstLength);          dstPtr[dstLength] = 0;        }      }	  // ack, this is silly - why pass through unicodeStr2 back to convertedString?      NS_IF_RELEASE(encoder);      nsString unicodeStr2(dstPtr);      convertedString = (char *) PR_Malloc(dstLength + 1);      if (convertedString)        unicodeStr2.ToCString(convertedString, dstLength + 1, 0);        }    PR_FREEIF(dstPtr);    return convertedString;}