NS_RELEASE(head);
nsHTMLTableElement::CreateTHead(nsIDOMHTMLElement** aValue){  *aValue = nsnull;  nsresult rv = NS_OK;  nsIDOMHTMLTableSectionElement *head=nsnull;  GetTHead(&head);  if (nsnull!=head)  { // return the existing thead    head->QueryInterface(kIDOMHTMLElementIID, (void **)aValue);  // caller's addref    NS_ASSERTION(nsnull!=*aValue, "head must be a DOMHTMLElement");    NS_RELEASE(head);  }  else  { // create a new head rowgroup    nsIHTMLContent *newHead=nsnull;    rv = NS_NewHTMLTableSectionElement(&newHead,nsHTMLAtoms::thead);    if (NS_SUCCEEDED(rv) && (nsnull!=newHead))    {      rv = mInner.AppendChildTo(newHead, PR_TRUE);      newHead->QueryInterface(kIDOMHTMLElementIID, (void **)aValue); // caller's addref      NS_RELEASE(newHead);    }  }  return NS_OK;}