| 2466 | */ |
| 2467 | |
| 2468 | void |
| 2469 | xmlFreeParserCtxt(xmlParserCtxtPtr ctxt) |
| 2470 | { |
| 2471 | xmlParserInputPtr input; |
| 2472 | |
| 2473 | if (ctxt == NULL) return; |
| 2474 | |
| 2475 | while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ |
| 2476 | xmlFreeInputStream(input); |
| 2477 | } |
| 2478 | if (ctxt->spaceTab != NULL) xmlFree(ctxt->spaceTab); |
| 2479 | if (ctxt->nameTab != NULL) xmlFree((xmlChar * *)ctxt->nameTab); |
| 2480 | if (ctxt->nodeTab != NULL) xmlFree(ctxt->nodeTab); |
| 2481 | if (ctxt->nodeInfoTab != NULL) xmlFree(ctxt->nodeInfoTab); |
| 2482 | if (ctxt->inputTab != NULL) xmlFree(ctxt->inputTab); |
| 2483 | if (ctxt->version != NULL) xmlFree((char *) ctxt->version); |
| 2484 | if (ctxt->encoding != NULL) xmlFree((char *) ctxt->encoding); |
| 2485 | if (ctxt->extSubURI != NULL) xmlFree((char *) ctxt->extSubURI); |
| 2486 | if (ctxt->extSubSystem != NULL) xmlFree((char *) ctxt->extSubSystem); |
| 2487 | #ifdef LIBXML_SAX1_ENABLED |
| 2488 | if ((ctxt->sax != NULL) && |
| 2489 | (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)) |
| 2490 | #else |
| 2491 | if (ctxt->sax != NULL) |
| 2492 | #endif /* LIBXML_SAX1_ENABLED */ |
| 2493 | xmlFree(ctxt->sax); |
| 2494 | if (ctxt->directory != NULL) xmlFree(ctxt->directory); |
| 2495 | if (ctxt->vctxt.nodeTab != NULL) xmlFree(ctxt->vctxt.nodeTab); |
| 2496 | if (ctxt->atts != NULL) xmlFree((xmlChar * *)ctxt->atts); |
| 2497 | if (ctxt->dict != NULL) xmlDictFree(ctxt->dict); |
| 2498 | if (ctxt->nsTab != NULL) xmlFree(ctxt->nsTab); |
| 2499 | if (ctxt->nsdb != NULL) xmlParserNsFree(ctxt->nsdb); |
| 2500 | if (ctxt->attrHash != NULL) xmlFree(ctxt->attrHash); |
| 2501 | if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab); |
| 2502 | if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs); |
| 2503 | if (ctxt->attsDefault != NULL) |
| 2504 | xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator); |
| 2505 | if (ctxt->attsSpecial != NULL) |
| 2506 | xmlHashFree(ctxt->attsSpecial, NULL); |
| 2507 | if (ctxt->freeElems != NULL) { |
| 2508 | xmlNodePtr cur, next; |
| 2509 | |
| 2510 | cur = ctxt->freeElems; |
| 2511 | while (cur != NULL) { |
| 2512 | next = cur->next; |
| 2513 | xmlFree(cur); |
| 2514 | cur = next; |
| 2515 | } |
| 2516 | } |
| 2517 | if (ctxt->freeAttrs != NULL) { |
| 2518 | xmlAttrPtr cur, next; |
| 2519 | |
| 2520 | cur = ctxt->freeAttrs; |
| 2521 | while (cur != NULL) { |
| 2522 | next = cur->next; |
| 2523 | xmlFree(cur); |
| 2524 | cur = next; |
| 2525 | } |