mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-11 21:34:53 -04:00
Fix lock leak in be_pair_flush() if flush type is BEV_NORMAL
Fixes: bufferevent/bufferevent_pair_flush_normal $ regress --no-fork bufferevent/bufferevent_pair_flush_normal bufferevent/bufferevent_pair_flush_normal: FAIL ../test/regress_bufferevent.c:181: assert(bufferevent_pair_get_partner(bev1) == NULL): 0x177fa20 vs (nil) [bufferevent_pair_flush_normal FAILED] Fixes #266
This commit is contained in:
parent
ad52602ffd
commit
f45d39d1a4
@ -307,15 +307,17 @@ be_pair_flush(struct bufferevent *bev, short iotype,
|
||||
{
|
||||
struct bufferevent_pair *bev_p = upcast(bev);
|
||||
struct bufferevent *partner;
|
||||
incref_and_lock(bev);
|
||||
|
||||
if (!bev_p->partner)
|
||||
return -1;
|
||||
|
||||
partner = downcast(bev_p->partner);
|
||||
|
||||
if (mode == BEV_NORMAL)
|
||||
return 0;
|
||||
|
||||
incref_and_lock(bev);
|
||||
|
||||
partner = downcast(bev_p->partner);
|
||||
|
||||
if ((iotype & EV_READ) != 0)
|
||||
be_pair_transfer(partner, bev, 1);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user