Skip to content

Commit

Permalink
Avoid double-free on error in evbuffer_add_file. Found by coverity.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmathewson committed Jul 26, 2012
1 parent 6487f63 commit 6a81b1f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3184,7 +3184,8 @@ evbuffer_add_file(struct evbuffer *buf, int fd, ev_off_t offset, ev_off_t length
if (!seg)
return -1;
r = evbuffer_add_file_segment(buf, seg, 0, length);
evbuffer_file_segment_free(seg);
if (r == 0)
evbuffer_file_segment_free(seg);
return r;
}

Expand Down

0 comments on commit 6a81b1f

Please sign in to comment.