* xmlFreeAttribute: * @elem: An attribute * * Deallocate the memory used by an attribute definition */
| 1596 | * Deallocate the memory used by an attribute definition |
| 1597 | */ |
| 1598 | static void |
| 1599 | xmlFreeAttribute(xmlAttributePtr attr) { |
| 1600 | xmlDictPtr dict; |
| 1601 | |
| 1602 | if (attr == NULL) return; |
| 1603 | if (attr->doc != NULL) |
| 1604 | dict = attr->doc->dict; |
| 1605 | else |
| 1606 | dict = NULL; |
| 1607 | xmlUnlinkNode((xmlNodePtr) attr); |
| 1608 | if (attr->tree != NULL) |
| 1609 | xmlFreeEnumeration(attr->tree); |
| 1610 | if (dict) { |
| 1611 | if ((attr->elem != NULL) && (!xmlDictOwns(dict, attr->elem))) |
| 1612 | xmlFree((xmlChar *) attr->elem); |
| 1613 | if ((attr->name != NULL) && (!xmlDictOwns(dict, attr->name))) |
| 1614 | xmlFree((xmlChar *) attr->name); |
| 1615 | if ((attr->prefix != NULL) && (!xmlDictOwns(dict, attr->prefix))) |
| 1616 | xmlFree((xmlChar *) attr->prefix); |
| 1617 | if ((attr->defaultValue != NULL) && |
| 1618 | (!xmlDictOwns(dict, attr->defaultValue))) |
| 1619 | xmlFree((xmlChar *) attr->defaultValue); |
| 1620 | } else { |
| 1621 | if (attr->elem != NULL) |
| 1622 | xmlFree((xmlChar *) attr->elem); |
| 1623 | if (attr->name != NULL) |
| 1624 | xmlFree((xmlChar *) attr->name); |
| 1625 | if (attr->defaultValue != NULL) |
| 1626 | xmlFree((xmlChar *) attr->defaultValue); |
| 1627 | if (attr->prefix != NULL) |
| 1628 | xmlFree((xmlChar *) attr->prefix); |
| 1629 | } |
| 1630 | xmlFree(attr); |
| 1631 | } |
| 1632 | |
| 1633 | |
| 1634 | /** |
no test coverage detected