comparison src/http/modules/ngx_http_xslt_filter_module.c @ 2984:097c1242995b

preserve XML wellFormed field before freeing memory
author Igor Sysoev <igor@sysoev.ru>
date Fri, 17 Jul 2009 08:04:52 +0000
parents 4cc8b90f8cef
children 5aa29f3d8832
comparison
equal deleted inserted replaced
2983:4cc8b90f8cef 2984:097c1242995b
245 245
246 246
247 static ngx_int_t 247 static ngx_int_t
248 ngx_http_xslt_body_filter(ngx_http_request_t *r, ngx_chain_t *in) 248 ngx_http_xslt_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
249 { 249 {
250 int wellFormed;
250 ngx_chain_t *cl; 251 ngx_chain_t *cl;
251 ngx_http_xslt_filter_ctx_t *ctx; 252 ngx_http_xslt_filter_ctx_t *ctx;
252 253
253 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 254 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
254 "xslt filter body"); 255 "xslt filter body");
286 287
287 #if (NGX_HTTP_XSLT_REUSE_DTD) 288 #if (NGX_HTTP_XSLT_REUSE_DTD)
288 ctx->doc->extSubset = NULL; 289 ctx->doc->extSubset = NULL;
289 #endif 290 #endif
290 291
292 wellFormed = ctx->ctxt->wellFormed;
293
291 xmlFreeParserCtxt(ctx->ctxt); 294 xmlFreeParserCtxt(ctx->ctxt);
292 295
293 if (ctx->ctxt->wellFormed) { 296 if (wellFormed) {
294 return ngx_http_xslt_send(r, ctx, 297 return ngx_http_xslt_send(r, ctx,
295 ngx_http_xslt_apply_stylesheet(r, ctx)); 298 ngx_http_xslt_apply_stylesheet(r, ctx));
296 } 299 }
297 300
298 xmlFreeDoc(ctx->doc); 301 xmlFreeDoc(ctx->doc);