tests: Fix potential NULL pointer dereference

This commit is contained in:
icy17 2024-08-07 17:20:46 +08:00 committed by Azat Khuzhin
parent d3f6c78e3a
commit d1a90d09dc
3 changed files with 10 additions and 0 deletions

View File

@ -197,6 +197,10 @@ main(int argc, char **argv)
base = event_base_new();
if (base == NULL) {
return 1;
}
for (i=0; i < PARALLELISM; ++i) {
if (launch_request() < 0)
fprintf(stderr, "Cannot launch %i request\n", i);

View File

@ -2116,6 +2116,8 @@ test_loopexit_multiple(void)
base = event_base_new();
tt_assert(base);
tv.tv_usec = 200*1000;
tv.tv_sec = 0;
event_base_loopexit(base, &tv);

View File

@ -627,6 +627,8 @@ wm_acceptcb(struct evconnlistener *listener, evutil_socket_t fd,
bev = bufferevent_ssl_socket_new(
base, fd, ssl, BUFFEREVENT_SSL_ACCEPTING, ctx->flags);
tt_assert(bev);
TT_BLATHER(("wm_transfer-%s(%p): accept",
ctx->server ? "server" : "client", bev));
@ -638,6 +640,8 @@ wm_acceptcb(struct evconnlistener *listener, evutil_socket_t fd,
/* Only accept once, then disable ourself. */
evconnlistener_disable(listener);
end:
;
}
static void
regress_bufferevent_openssl_wm(void *arg)