Skip to content

Commit

Permalink
bufferevent_pair: don't call downcast(NULL)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmathewson committed Feb 9, 2014
1 parent dfe1e52 commit f2428a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bufferevent_pair.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,14 @@ struct bufferevent *
bufferevent_pair_get_partner(struct bufferevent *bev)
{
struct bufferevent_pair *bev_p;
struct bufferevent *partner;
struct bufferevent *partner = NULL;
bev_p = upcast(bev);
if (! bev_p)
return NULL;

incref_and_lock(bev);
partner = downcast(bev_p->partner);
if (bev_p->partner)
partner = downcast(bev_p->partner);
decref_and_unlock(bev);
return partner;
}
Expand Down

0 comments on commit f2428a2

Please sign in to comment.