FAIL: if (mdd) { PR_Free(mdd->url_name); PR_Free(mdd->originalMsgURI); if (mdd->options) delete mdd->options; PR_Free ( mdd ); } PR_Free ( stream ); PR_Free ( obj );  return nsnull;
mime_bridge_create_draft_stream(                          nsIMimeEmitter      *newEmitter,                          nsStreamConverter   *newPluginObj2,                          nsIURI              *uri,                          nsMimeOutputType    format_out){  int                     status = 0;  nsMIMESession           *stream = nsnull;  struct mime_draft_data  *mdd = nsnull;  MimeObject              *obj;  if ( !uri )     return nsnull;  mdd = PR_NEWZAP(struct mime_draft_data);  if (!mdd)     return nsnull;  // first, convert the rdf msg uri into a url that represents the message...  nsCAutoString turl;  if (NS_FAILED(uri->GetSpec(turl)))    return nsnull;  nsCOMPtr <nsIMsgMessageService> msgService;  nsresult rv = GetMessageServiceFromURI(turl.get(), getter_AddRefs(msgService));  if (NS_FAILED(rv))     return nsnull;  nsCOMPtr<nsIURI> aURL;  rv = msgService->GetUrlForUri(turl.get(), getter_AddRefs(aURL), nsnull);  if (NS_FAILED(rv))     return nsnull;  nsCAutoString urlString;  if (NS_SUCCEEDED(aURL->GetSpec(urlString)))  {    mdd->url_name = ToNewCString(urlString);    if (!(mdd->url_name))    {      PR_FREEIF(mdd);      return nsnull;    }  }  newPluginObj2->GetForwardInline(&mdd->forwardInline);  newPluginObj2->GetIdentity(getter_AddRefs(mdd->identity));  mdd->format_out = format_out;  mdd->options = new  MimeDisplayOptions ;  if ( !mdd->options )   {    PR_FREEIF(mdd->url_name);    PR_FREEIF(mdd);    return nsnull;  }  mdd->options->url = nsCRT::strdup(mdd->url_name);  mdd->options->format_out = format_out;     // output format  mdd->options->decompose_file_p = PR_TRUE; /* new field in MimeDisplayOptions */  mdd->options->stream_closure = mdd;  mdd->options->html_closure = mdd;  mdd->options->decompose_headers_info_fn = make_mime_headers_copy;  mdd->options->decompose_file_init_fn = mime_decompose_file_init_fn;  mdd->options->decompose_file_output_fn = mime_decompose_file_output_fn;  mdd->options->decompose_file_close_fn = mime_decompose_file_close_fn;  rv = nsServiceManager::GetService(kPrefCID, NS_GET_IID(nsIPref), (nsISupports**)&(mdd->options->prefs));  if (! (mdd->options->prefs && NS_SUCCEEDED(rv)))  {    PR_FREEIF(mdd);    return nsnull;  }#ifdef FO_MAIL_MESSAGE_TO  /* If we're attaching a message (for forwarding) then we must eradicate all   traces of xlateion from it, since forwarding someone else a message   that wasn't xlated for them doesn't work.  We have to dexlate it   before sending it.   */// RICHIE  mdd->options->dexlate_p = PR_TRUE;#endif /* FO_MAIL_MESSAGE_TO */  obj = mime_new ( (MimeObjectClass *) &mimeMessageClass, (MimeHeaders *) NULL, MESSAGE_RFC822 );  if ( !obj )   {    PR_FREEIF(mdd->url_name);    delete mdd->options;    PR_FREEIF(mdd );    return nsnull;  }    obj->options = mdd->options;  mdd->obj = obj;  stream = PR_NEWZAP ( nsMIMESession );  if ( !stream )   {    PR_FREEIF(mdd->url_name);    delete mdd->options;    PR_FREEIF ( mdd );    PR_FREEIF ( obj );    return nsnull;  }  stream->name = "MIME To Draft Converter Stream";  stream->complete = mime_parse_stream_complete;  stream->abort = mime_parse_stream_abort;  stream->put_block = mime_parse_stream_write;  stream->data_object = mdd;  status = obj->clazz->initialize ( obj );  if ( status >= 0 )    status = obj->clazz->parse_begin ( obj );  if ( status < 0 )   {    PR_FREEIF(mdd->url_name);    PR_FREEIF ( stream );    delete mdd->options;    PR_FREEIF ( mdd );    PR_FREEIF ( obj );    return nsnull;  }  return stream;}