[Mod_transform] Memory leak

spinmar at libero.it spinmar at libero.it
Fri Jul 13 03:33:23 EDT 2007


There is something I don't understand related a possible memory leak.
In mod_transform.c, line 218:

if (APR_BUCKET_IS_EOS(b)) {
  if (ctxt) {         /* done reading the file. run the transform now */
        xmlParseChunk(ctxt, buf, 0, 1);
        ret = transform_run(f, ctxt->myDoc);
        xmlFreeParserCtxt(ctxt);
  }
}

where the transform is done. 
Reading the documentation about xmlFreeParserCtxt() from xmlsoft.org:

"Free all the memory used by a parser context. However the parsed document in ctxt->myDoc is not freed."

So ctxt->myDoc is not freedand in mod_transform I can't find where ctxt->myDoc is freed.
In my opinion it should be:

if (APR_BUCKET_IS_EOS(b)) {
  if (ctxt) {         /* done reading the file. run the transform now */
        xmlParseChunk(ctxt, buf, 0, 1);
        ret = transform_run(f, ctxt->myDoc);
        xmlFreeDoc(ctxt->myDoc);
        xmlFreeParserCtxt(ctxt);
  }
}

Am I rigth or not?
Best regards

Marco





------------------------------------------------------
Leggi GRATIS le tue mail con il telefonino i-mode™ di Wind
http://i-mode.wind.it/



More information about the Mod_transform mailing list