diff --git a/dlls/msxml3/stylesheet.c b/dlls/msxml3/stylesheet.c index 4c4f60ee0fa..9863ed7aa4b 100644 --- a/dlls/msxml3/stylesheet.c +++ b/dlls/msxml3/stylesheet.c @@ -570,9 +570,8 @@ static HRESULT WINAPI xslprocessor_transform( TRACE("(%p)->(%p)\n", This, ret); - if (!ret) return E_INVALIDARG; - - SysFreeString(This->outstr); + if (!ret) + return E_INVALIDARG; if (This->output_type == PROCESSOR_OUTPUT_STREAM) { @@ -582,9 +581,12 @@ static HRESULT WINAPI xslprocessor_transform( else if (This->output_type == PROCESSOR_OUTPUT_PERSISTSTREAM || This->output_type == PROCESSOR_OUTPUT_RESPONSE) { - CreateStreamOnHGlobal(NULL, TRUE, (IStream **)&stream); + if (FAILED(hr = CreateStreamOnHGlobal(NULL, TRUE, (IStream **)&stream))) + return hr; } + SysFreeString(This->outstr); + hr = node_transform_node_params(get_node_obj(This->input), This->stylesheet->node, &This->outstr, stream, &This->params); if (SUCCEEDED(hr)) @@ -612,7 +614,8 @@ static HRESULT WINAPI xslprocessor_transform( DWORD size; void *dest; - GetHGlobalFromStream(src, &hglobal); + if (FAILED(hr = GetHGlobalFromStream(src, &hglobal))) + break; size = GlobalSize(hglobal); bound.lLbound = 0;