Re: [xml] PATCH: implement xmlSaveToBuffer()

On Sun, Nov 06, 2005 at 06:07:52PM +0100, Geert Jansen wrote:

the attached patch implement the function xmlSaveToBuffer() which was 
documented but not implemented.

Can the patch be applied?

  Sounds wrong. You are using an xmlBufferPtr while ret->buf is expected
to be an xmlOutputBufferPtr. As a result if someone tries to free the returned
value with the xmlFreeSaveCtxt() call it will crash or corrupt memory.
If you compile with gcc you get a warning about this:
    xmlsave.c: In function `xmlSaveToBuffer':
    xmlsave.c:1489: warning: assignment from incompatible pointer type
That patch really can't be applied as-is, I really can't see how it would
have worked in any test either. Instead generate an xmlOutputBufferPtr
from the passed xmlBufferPtr and check that the passed buffer is not freed
when xmlFreeSaveCtxt is called, that should work correctly.

  Sorry, no, but thanks !


Daniel Veillard      | Red Hat
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]