mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
Avoid double-free in bufferevent read/write cbs
Fixes bug 3404; bugfix on 0.2.3.1-alpha.
This commit is contained in:
parent
f883ec09b5
commit
57822cbbbe
3
changes/bug3404
Normal file
3
changes/bug3404
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Minor bugfixes:
|
||||||
|
- Fix a class of double-mark-for-close bugs when bufferevents
|
||||||
|
are enabled. Fixes bug 3404; bugfix on 0.2.3.1-alpha.
|
@ -2957,9 +2957,11 @@ connection_handle_read_cb(struct bufferevent *bufev, void *arg)
|
|||||||
{
|
{
|
||||||
connection_t *conn = arg;
|
connection_t *conn = arg;
|
||||||
(void) bufev;
|
(void) bufev;
|
||||||
if (!conn->marked_for_close)
|
if (!conn->marked_for_close) {
|
||||||
if (connection_process_inbuf(conn, 1)<0) /* XXXX Always 1? */
|
if (connection_process_inbuf(conn, 1)<0) /* XXXX Always 1? */
|
||||||
connection_mark_for_close(conn);
|
if (!conn->marked_for_close)
|
||||||
|
connection_mark_for_close(conn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Callback: invoked whenever a bufferevent has written data. */
|
/** Callback: invoked whenever a bufferevent has written data. */
|
||||||
@ -2969,7 +2971,8 @@ connection_handle_write_cb(struct bufferevent *bufev, void *arg)
|
|||||||
connection_t *conn = arg;
|
connection_t *conn = arg;
|
||||||
struct evbuffer *output;
|
struct evbuffer *output;
|
||||||
if (connection_flushed_some(conn)<0) {
|
if (connection_flushed_some(conn)<0) {
|
||||||
connection_mark_for_close(conn);
|
if (!conn->marked_for_close)
|
||||||
|
connection_mark_for_close(conn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user