mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-11 05:14:46 -04:00
Add some missing null checks to unit tests; found by coverity
This commit is contained in:
parent
270f279fb5
commit
f021c3d762
@ -305,7 +305,7 @@ static void *
|
|||||||
legacy_test_setup(const struct testcase_t *testcase)
|
legacy_test_setup(const struct testcase_t *testcase)
|
||||||
{
|
{
|
||||||
struct basic_test_data *data = basic_test_setup(testcase);
|
struct basic_test_data *data = basic_test_setup(testcase);
|
||||||
if (data == (void*)TT_SKIP)
|
if (data == (void*)TT_SKIP || data == NULL)
|
||||||
return data;
|
return data;
|
||||||
global_base = data->base;
|
global_base = data->base;
|
||||||
pair[0] = data->pair[0];
|
pair[0] = data->pair[0];
|
||||||
|
@ -113,6 +113,7 @@ MessageCb(EVRPC_STRUCT(Message)* rpc, void *arg)
|
|||||||
struct evhttp_request* req = EVRPC_REQUEST_HTTP(rpc);
|
struct evhttp_request* req = EVRPC_REQUEST_HTTP(rpc);
|
||||||
const char *header = evhttp_find_header(
|
const char *header = evhttp_find_header(
|
||||||
req->input_headers, "X-Hook");
|
req->input_headers, "X-Hook");
|
||||||
|
assert(header);
|
||||||
assert(strcmp(header, "input") == 0);
|
assert(strcmp(header, "input") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,6 +333,7 @@ GotKillCb(struct evrpc_status *status,
|
|||||||
struct evhttp_request *req = status->http_req;
|
struct evhttp_request *req = status->http_req;
|
||||||
const char *header = evhttp_find_header(
|
const char *header = evhttp_find_header(
|
||||||
req->input_headers, "X-Pool-Hook");
|
req->input_headers, "X-Pool-Hook");
|
||||||
|
assert(header);
|
||||||
assert(strcmp(header, "ran") == 0);
|
assert(strcmp(header, "ran") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user