Commit 286174a5 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mshtml/tests: Test document stream creation failure (Coverity).

parent 93eac48c
......@@ -2246,6 +2246,7 @@ static void doc_load_string(IHTMLDocument2 *doc, const char *str)
IStream *stream;
HGLOBAL mem;
SIZE_T len;
HRESULT hr;
notif_doc = doc;
......@@ -2253,9 +2254,11 @@ static void doc_load_string(IHTMLDocument2 *doc, const char *str)
len = strlen(str);
mem = GlobalAlloc(0, len);
memcpy(mem, str, len);
CreateStreamOnHGlobal(mem, TRUE, &stream);
hr = CreateStreamOnHGlobal(mem, TRUE, &stream);
ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
hr = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hr == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hr);
IPersistStreamInit_Load(init, stream);
IPersistStreamInit_Release(init);
......
......@@ -10518,6 +10518,7 @@ static IHTMLDocument2 *create_doc_with_string(const char *str)
IHTMLDocument2 *doc;
HGLOBAL mem;
SIZE_T len;
HRESULT hr;
notif_doc = doc = create_document();
if(!doc)
......@@ -10527,9 +10528,11 @@ static IHTMLDocument2 *create_doc_with_string(const char *str)
len = strlen(str);
mem = GlobalAlloc(0, len);
memcpy(mem, str, len);
CreateStreamOnHGlobal(mem, TRUE, &stream);
hr = CreateStreamOnHGlobal(mem, TRUE, &stream);
ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
hr = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hr == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hr);
IPersistStreamInit_Load(init, stream);
IPersistStreamInit_Release(init);
......
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