Commit 58642340 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite: Don't release reader input reference on failure, as newer versions do.

parent 07e2730c
...@@ -103,11 +103,8 @@ static ULONG WINAPI xmlreader_Release(IXmlReader *iface) ...@@ -103,11 +103,8 @@ static ULONG WINAPI xmlreader_Release(IXmlReader *iface)
ref = InterlockedDecrement(&This->ref); ref = InterlockedDecrement(&This->ref);
if (ref == 0) if (ref == 0)
{ {
if (This->input) if (This->input) IUnknown_Release(This->input);
{ if (This->stream) IUnknown_Release(This->stream);
IUnknown_Release(This->stream);
IUnknown_Release(This->input);
}
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
...@@ -154,13 +151,7 @@ static HRESULT WINAPI xmlreader_SetInput(IXmlReader* iface, IUnknown *input) ...@@ -154,13 +151,7 @@ static HRESULT WINAPI xmlreader_SetInput(IXmlReader* iface, IUnknown *input)
/* set stream for supplied IXmlReaderInput */ /* set stream for supplied IXmlReaderInput */
hr = xmlreaderinput_query_for_stream(This->input, (void**)&This->stream); hr = xmlreaderinput_query_for_stream(This->input, (void**)&This->stream);
if (hr != S_OK) if (hr == S_OK)
{
/* IXmlReaderInput doesn't provide streaming interface */
IUnknown_Release(This->input);
This->input = NULL;
}
else
This->state = XmlReadState_Initial; This->state = XmlReadState_Initial;
return hr; return hr;
......
...@@ -440,6 +440,7 @@ static void test_readerinput(void) ...@@ -440,6 +440,7 @@ static void test_readerinput(void)
IUnknown_Release(reader_input); IUnknown_Release(reader_input);
IUnknown_Release(reader_input); IUnknown_Release(reader_input);
IUnknown_Release(reader_input);
IStream_Release(stream); IStream_Release(stream);
/* test input interface selection sequence */ /* test input interface selection sequence */
...@@ -479,7 +480,8 @@ static void test_readerinput(void) ...@@ -479,7 +480,8 @@ static void test_readerinput(void)
IUnknown_Release(input); IUnknown_Release(input);
ref = IUnknown_AddRef(reader_input); ref = IUnknown_AddRef(reader_input);
ok(ref == 2, "Expected 2, got %d\n", ref); ok(ref == 3 || broken(ref == 2) /* versions 1.0.x and 1.1.x - XP, Vista */,
"Expected 3, got %d\n", ref);
IUnknown_Release(reader_input); IUnknown_Release(reader_input);
/* repeat another time, no check or caching here */ /* repeat another time, no check or caching here */
input_iids.count = 0; input_iids.count = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment