mshtml/tests: Test return values in more places (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 2017-11-28 14:18:15 +03:00 committed by Alexandre Julliard
parent 196a97740e
commit f6d58e69e1
4 changed files with 23 additions and 10 deletions

View File

@ -7742,7 +7742,8 @@ static void doc_write(IHTMLDocument2 *doc, BOOL ln, const char *text)
dim.lLbound = 0;
dim.cElements = 1;
sa = SafeArrayCreate(VT_VARIANT, 1, &dim);
SafeArrayAccessData(sa, (void**)&var);
hres = SafeArrayAccessData(sa, (void**)&var);
ok(hres == S_OK, "Failed to access array data: %08x\n", hres);
V_VT(var) = VT_BSTR;
V_BSTR(var) = a2bstr(text);
SafeArrayUnaccessData(sa);
@ -7764,7 +7765,8 @@ static void doc_complex_write(IHTMLDocument2 *doc)
HRESULT hres;
sa = SafeArrayCreate(VT_VARIANT, 1, &dim);
SafeArrayAccessData(sa, (void**)&args);
hres = SafeArrayAccessData(sa, (void**)&args);
ok(hres == S_OK, "Failed to access array data: %08x\n", hres);
V_VT(args) = VT_BSTR;
V_BSTR(args) = a2bstr("<body i4val=\"");

View File

@ -3129,6 +3129,7 @@ static void doc_load_string(IHTMLDocument2 *doc, const char *str)
{
IPersistStreamInit *init;
IStream *stream;
HRESULT hres;
HGLOBAL mem;
SIZE_T len;
@ -3138,9 +3139,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);
hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
IPersistStreamInit_Load(init, stream);
IPersistStreamInit_Release(init);

View File

@ -1259,6 +1259,7 @@ static void load_string(IHTMLDocument2 *doc, const char *str)
{
IPersistStreamInit *init;
IStream *stream;
HRESULT hres;
HGLOBAL mem;
SIZE_T len;
@ -1266,9 +1267,11 @@ static void load_string(IHTMLDocument2 *doc, const char *str)
len = strlen(str);
mem = GlobalAlloc(0, len);
memcpy(mem, str, len);
CreateStreamOnHGlobal(mem, TRUE, &stream);
hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
IPersistStreamInit_Load(init, stream);
IPersistStreamInit_Release(init);
@ -2325,7 +2328,8 @@ static void test_script_run(void)
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = NULL;
dispex_propput(document, id, 0, &var, NULL);
hres = dispex_propput(document, id, 0, &var, NULL);
ok(hres == S_OK, "dispex_propput failed: %08x\n", hres);
VariantInit(&var);
memset(&dp, 0, sizeof(dp));
@ -2823,7 +2827,8 @@ static void report_data(ProtocolHandler *This)
IServiceProvider_Release(service_provider);
ok(hres == S_OK, "Could not get IHttpNegotiate interface: %08x\n", hres);
IUri_GetDisplayUri(This->uri, &url);
hres = IUri_GetDisplayUri(This->uri, &url);
ok(hres == S_OK, "Failed to get display uri: %08x\n", hres);
hres = IHttpNegotiate_BeginningTransaction(http_negotiate, url, emptyW, 0, &addl_headers);
ok(hres == S_OK, "BeginningTransaction failed: %08x\n", hres);
SysFreeString(url);

View File

@ -3144,6 +3144,7 @@ static IHTMLDocument2 *create_doc_with_string(const char *str)
IPersistStreamInit *init;
IStream *stream;
IHTMLDocument2 *doc;
HRESULT hres;
HGLOBAL mem;
SIZE_T len;
@ -3155,9 +3156,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);
hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
IPersistStreamInit_Load(init, stream);
IPersistStreamInit_Release(init);