Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Avoid double-free on error in evbuffer_add_file. Found by coverity.

  • Loading branch information...
commit 6a81b1f5a423aa5ec237c085c94bdc0a6cfd9e5d 1 parent 6487f63
Nick Mathewson authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  buffer.c
View
3  buffer.c
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.