test/test-changelist.c: fix potential NULL pointer dereference

This commit is contained in:
icy17 2024-04-10 17:25:54 +08:00 committed by Azat Khuzhin
parent 66428fb969
commit 6f9f2f3a09

View File

@ -188,9 +188,12 @@ main(int argc, char **argv)
/* Initialize a timeout to terminate the test */ /* Initialize a timeout to terminate the test */
timeout = evtimer_new(base,timeout_cb,&timeout); timeout = evtimer_new(base,timeout_cb,&timeout);
if (timeout == NULL)
return (1);
/* and watch for writability on one end of the pipe */ /* and watch for writability on one end of the pipe */
ev = event_new(base,pair[1],EV_WRITE | EV_PERSIST, write_cb, &ev); ev = event_new(base,pair[1],EV_WRITE | EV_PERSIST, write_cb, &ev);
if (ev == NULL)
return (1);
tv.tv_sec = 1; tv.tv_sec = 1;
tv.tv_usec = 500*1000; tv.tv_usec = 500*1000;