mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Avoid more crashes/bad calls in unit tests; found by coverity
This commit is contained in:
parent
f021c3d762
commit
3cde5bf57a
@ -2258,6 +2258,7 @@ end:
|
||||
event_free(ev1);
|
||||
if (ev2)
|
||||
event_free(ev2);
|
||||
if (dfd >= 0)
|
||||
close(dfd);
|
||||
}
|
||||
#endif
|
||||
|
@ -243,6 +243,8 @@ test_bufferevent_watermarks_impl(int use_pair)
|
||||
bev1 = bufferevent_new(pair[0], NULL, wm_writecb, wm_errorcb, NULL);
|
||||
bev2 = bufferevent_new(pair[1], wm_readcb, NULL, wm_errorcb, NULL);
|
||||
}
|
||||
tt_assert(bev1);
|
||||
tt_assert(bev2);
|
||||
bufferevent_disable(bev1, EV_READ);
|
||||
bufferevent_enable(bev2, EV_READ);
|
||||
|
||||
@ -267,7 +269,9 @@ test_bufferevent_watermarks_impl(int use_pair)
|
||||
tt_assert(!event_pending(&bev2->ev_write, EV_WRITE, NULL));
|
||||
|
||||
end:
|
||||
if (bev1)
|
||||
bufferevent_free(bev1);
|
||||
if (bev2)
|
||||
bufferevent_free(bev2);
|
||||
}
|
||||
|
||||
@ -377,7 +381,9 @@ test_bufferevent_filters_impl(int use_pair)
|
||||
test_ok = 0;
|
||||
|
||||
end:
|
||||
if (bev1)
|
||||
bufferevent_free(bev1);
|
||||
if (bev2)
|
||||
bufferevent_free(bev2);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user