# HG changeset patch # User Igor Sysoev # Date 1247817892 0 # Node ID 097c1242995b4c51ccd8a67ef9fd51a133773b25 # Parent 4cc8b90f8cefafb00f747386df3b2468e1346211 preserve XML wellFormed field before freeing memory diff --git a/src/http/modules/ngx_http_xslt_filter_module.c b/src/http/modules/ngx_http_xslt_filter_module.c --- a/src/http/modules/ngx_http_xslt_filter_module.c +++ b/src/http/modules/ngx_http_xslt_filter_module.c @@ -247,6 +247,7 @@ ngx_http_xslt_header_filter(ngx_http_req static ngx_int_t ngx_http_xslt_body_filter(ngx_http_request_t *r, ngx_chain_t *in) { + int wellFormed; ngx_chain_t *cl; ngx_http_xslt_filter_ctx_t *ctx; @@ -288,9 +289,11 @@ ngx_http_xslt_body_filter(ngx_http_reque ctx->doc->extSubset = NULL; #endif + wellFormed = ctx->ctxt->wellFormed; + xmlFreeParserCtxt(ctx->ctxt); - if (ctx->ctxt->wellFormed) { + if (wellFormed) { return ngx_http_xslt_send(r, ctx, ngx_http_xslt_apply_stylesheet(r, ctx)); }