Nikolay Sivov : msxml3: Duplicate stylesheet document before passing it to libxslt.

Alexandre Julliard julliard at winehq.org
Tue Jan 31 15:42:51 CST 2017


Module: wine
Branch: master
Commit: 2191d9776508132a9073e37dabe444a251938c2a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2191d9776508132a9073e37dabe444a251938c2a

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Jan 31 14:47:44 2017 +0300

msxml3: Duplicate stylesheet document before passing it to libxslt.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msxml3/node.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index ccecaa8..c5a180b 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -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);
 




More information about the wine-cvs mailing list