Skip to content

Commit

Permalink
endpoint: Avoid double-frees when recv fails, thanks r0ro
Browse files Browse the repository at this point in the history
  • Loading branch information
nipo committed Jan 7, 2012
1 parent dbab2d4 commit 0afaa63
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ _endpoint_handle_incoming(struct ela_event_source *src,
rudp_error_t ret = rudp_endpoint_recv(
endpoint, pc->packet, &pc->len, &addr);

if ( ret != 0 )
rudp_packet_chain_free(endpoint->rudp, pc);

endpoint->handler->handle_packet(endpoint, &addr, pc);
if (ret == 0)
endpoint->handler->handle_packet(endpoint, &addr, pc);

rudp_packet_chain_free(endpoint->rudp, pc);
}
Expand Down

0 comments on commit 0afaa63

Please sign in to comment.