msxml3: Duplicate stylesheet document before passing it to libxslt.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-01-31 14:47:44 +03:00 committed by Alexandre Julliard
parent b280c3bf2e
commit 2191d97765
1 changed files with 7 additions and 5 deletions

View File

@ -1320,6 +1320,7 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet,
{
#ifdef SONAME_LIBXSLT
xsltStylesheetPtr xsltSS;
xmlDocPtr sheet_doc;
HRESULT hr = S_OK;
xmlnode *sheet;
@ -1331,8 +1332,9 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet,
sheet = get_node_obj(stylesheet);
if(!sheet) return E_FAIL;
xsltSS = pxsltParseStylesheetDoc(sheet->node->doc);
if(xsltSS)
sheet_doc = xmlCopyDoc(sheet->node->doc, 1);
xsltSS = pxsltParseStylesheetDoc(sheet_doc);
if (xsltSS)
{
const char **xslparams = NULL;
xmlDocPtr result;
@ -1377,11 +1379,11 @@ HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet,
hr = node_transform_write_to_bstr(xsltSS, result, p);
xmlFreeDoc(result);
}
/* libxslt "helpfully" frees the XML document the stylesheet was
generated from, too */
xsltSS->doc = NULL;
pxsltFreeStylesheet(xsltSS);
}
else
xmlFreeDoc(sheet_doc);
if(!*p) *p = SysAllocStringLen(NULL, 0);