Add some missing null checks to unit tests; found by coverity

This commit is contained in:
Nick Mathewson 2012-07-26 09:59:47 -04:00
parent 270f279fb5
commit f021c3d762
2 changed files with 3 additions and 1 deletions

View File

@ -305,7 +305,7 @@ static void *
legacy_test_setup(const struct testcase_t *testcase)
{
struct basic_test_data *data = basic_test_setup(testcase);
if (data == (void*)TT_SKIP)
if (data == (void*)TT_SKIP || data == NULL)
return data;
global_base = data->base;
pair[0] = data->pair[0];

View File

@ -113,6 +113,7 @@ MessageCb(EVRPC_STRUCT(Message)* rpc, void *arg)
struct evhttp_request* req = EVRPC_REQUEST_HTTP(rpc);
const char *header = evhttp_find_header(
req->input_headers, "X-Hook");
assert(header);
assert(strcmp(header, "input") == 0);
}
@ -332,6 +333,7 @@ GotKillCb(struct evrpc_status *status,
struct evhttp_request *req = status->http_req;
const char *header = evhttp_find_header(
req->input_headers, "X-Pool-Hook");
assert(header);
assert(strcmp(header, "ran") == 0);
}