*attrib += i; nsMemory::Free(headersString);
*attrib += i;
nsresult NS_MsgGetAttributeFromString(const char *string, PRInt16 *attrib){	if (NULL == string || NULL == attrib)		return NS_ERROR_NULL_POINTER;	PRBool found = PR_FALSE;	for (int idxAttrib = 0; idxAttrib < (int)(sizeof(SearchAttribEntryTable) / sizeof(nsMsgSearchAttribEntry)); idxAttrib++)	{		if (!PL_strcasecmp(string, SearchAttribEntryTable[idxAttrib].attribName))		{			found = PR_TRUE;			*attrib = SearchAttribEntryTable[idxAttrib].attrib;			break;		}	}  	if (!found)  {    nsresult rv;    //49 is for showing customize... in ui, headers start from 50 onwards up until 99.    *attrib = nsMsgSearchAttrib::OtherHeader+1;    nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);    NS_ENSURE_SUCCESS(rv, rv);    nsCOMPtr<nsIPrefBranch> prefBranch;    rv = prefService->GetBranch(nsnull, getter_AddRefs(prefBranch));    NS_ENSURE_SUCCESS(rv, rv);    nsXPIDLCString headers;    prefBranch->GetCharPref(MAILNEWS_CUSTOM_HEADERS, getter_Copies(headers));    if (!headers.IsEmpty())    {      char *headersString = ToNewCString(headers);      char *newStr=nsnull;      char *token = nsCRT::strtok(headersString,": ", &newStr);      PRUint32 i=0;      while (token)      {        if (nsCRT::strcasecmp(token, string) == 0)        {          *attrib += i;           nsMemory::Free(headersString); //we found custom header in the pref          return NS_OK;        }        token = nsCRT::strtok(newStr,": ", &newStr);        i++;        //we know we can have a max of 50 custom headers        if ( nsMsgSearchAttrib::OtherHeader + i >= nsMsgSearchAttrib::kNumMsgSearchAttributes -1)        {           nsMemory::Free(headersString);           NS_ASSERTION(0, "pref has more headers than the table can hold");           return NS_MSG_CUSTOM_HEADERS_OVERFLOW;        }      }      *attrib += i; //this is *attrib for the new custom header       nsMemory::Free(headersString);      headers.Append(": "); //Adding additonal header to the pref so append the separator    }    headers.Append(string);    prefBranch->SetCharPref(MAILNEWS_CUSTOM_HEADERS, headers);    prefService->SavePrefFile(nsnull); //save customHeader pref - we have added a new header  }		return NS_OK;      // we always succeed now}