Fix some more bugs in contrib/xml2's xslt_process().
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 5 Jun 2012 00:12:50 +0000 (20:12 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 5 Jun 2012 00:12:50 +0000 (20:12 -0400)
commitd9b31e4859df5325b7d3d2cc94b0e907f1cf1d3e
tree05c54b300e09e0e05f12ce502c8e33be10351f6e
parentd73b7f973db5ec7e44813141741d3e0d318eef69
Fix some more bugs in contrib/xml2's xslt_process().

It failed to check for error return from xsltApplyStylesheet(), as reported
by Peter Gagarinov.  (So far as I can tell, libxslt provides no convenient
way to get a useful error message in failure cases.  There might be some
inconvenient way, but considering that this code is deprecated it's hard to
get enthusiastic about putting lots of work into it.  So I just made it say
"failed to apply stylesheet", in line with the existing error checks.)

While looking at the code I also noticed that the string returned by
xsltSaveResultToString was never freed, resulting in a session-lifespan
memory leak.

Back-patch to all supported versions.
contrib/xml2/xslt_proc.c