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

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-01-05 14:38:56 +03:00 committed by Alexandre Julliard
parent 93eac48cc7
commit 286174a5ac
2 changed files with 10 additions and 4 deletions

View File

@ -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);

View File

@ -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);