delete[] src;
nsImageDocument::CreateSyntheticDocument(){  // Synthesize an html document that refers to the image  nsresult rv;  nsCOMPtr<nsINodeInfo> nodeInfo;  rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::html, nsnull,                                     kNameSpaceID_None,                                     *getter_AddRefs(nodeInfo));  NS_ENSURE_SUCCESS(rv, rv);  nsIHTMLContent* root;  rv = NS_NewHTMLHtmlElement(&root, nodeInfo);  if (NS_OK != rv) {    return rv;  }  root->SetDocument(this, PR_FALSE, PR_TRUE);  SetRootContent(root);  rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::body, nsnull,                                     kNameSpaceID_None,                                     *getter_AddRefs(nodeInfo));  NS_ENSURE_SUCCESS(rv, rv);  nsIHTMLContent* body;  rv = NS_NewHTMLBodyElement(&body, nodeInfo);  if (NS_OK != rv) {    return rv;  }  body->SetDocument(this, PR_FALSE, PR_TRUE);  rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::p, nsnull, kNameSpaceID_None,                                     *getter_AddRefs(nodeInfo));  NS_ENSURE_SUCCESS(rv, rv);  nsIHTMLContent* center;  rv = NS_NewHTMLParagraphElement(&center, nodeInfo);  if (NS_OK != rv) {    return rv;  }  center->SetDocument(this, PR_FALSE, PR_TRUE);  rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::img, nsnull,                                     kNameSpaceID_None,                                     *getter_AddRefs(nodeInfo));  NS_ENSURE_SUCCESS(rv, rv);  nsIHTMLContent* image;  rv = NS_NewHTMLImageElement(&image, nodeInfo);  if (NS_OK != rv) {    return rv;  }  image->SetDocument(this, PR_FALSE, PR_TRUE);  char* src;  mDocumentURL->GetSpec(&src);  nsString src_string; src_string.AssignWithConversion(src);  nsHTMLValue val(src_string);  delete[] src;  image->SetHTMLAttribute(nsHTMLAtoms::src, val, PR_FALSE);  image->SetHTMLAttribute(nsHTMLAtoms::alt, val, PR_FALSE);  root->AppendChildTo(body, PR_FALSE);  center->AppendChildTo(image, PR_FALSE);  body->AppendChildTo(center, PR_FALSE);  NS_RELEASE(image);  NS_RELEASE(center);  NS_RELEASE(body);  NS_RELEASE(root);  return NS_OK;}