From: Nick Mathewson Date: Thu, 26 Jul 2012 13:59:47 +0000 (-0400) Subject: Add some missing null checks to unit tests; found by coverity X-Git-Tag: release-2.0.20-stable~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f021c3d762991d9cc81a222a631b6c075b1a76c0;p=libevent Add some missing null checks to unit tests; found by coverity --- diff --git a/test/regress_main.c b/test/regress_main.c index bbac2b41..e32afff7 100644 --- a/test/regress_main.c +++ b/test/regress_main.c @@ -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]; diff --git a/test/regress_rpc.c b/test/regress_rpc.c index e03adcdf..7604ca44 100644 --- a/test/regress_rpc.c +++ b/test/regress_rpc.c @@ -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); }