From: Pavel Charvat Date: Mon, 12 Feb 2018 11:17:52 +0000 (+0100) Subject: Main recio: Fixed crashes when a second rec_io_add() followed rec_io_del(). X-Git-Tag: v6.5.9~4 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=20d5027ab105ac1c174c7eefc00c7e482e99da7a;p=libucw.git Main recio: Fixed crashes when a second rec_io_add() followed rec_io_del(). --- diff --git a/ucw/main-rec.c b/ucw/main-rec.c index f13758e3..d3d4a589 100644 --- a/ucw/main-rec.c +++ b/ucw/main-rec.c @@ -58,13 +58,18 @@ rec_io_del(struct main_rec_io *rio) hook_del(&rio->start_read_hook); file_del(&rio->file); + rio->file.read_handler = NULL; + rio->read_started = rio->read_running = 0; + rio->read_avail = rio->read_prev_avail = 0; if (rio->read_buf) { DBG("RIO: Freeing read buffer"); xfree(rio->read_buf); - rio->read_buf = NULL; + rio->read_buf = rio->read_rec_start = NULL; } + rio->file.write_handler = NULL; + rio->write_watermark = 0; struct rio_buffer *b; while ((b = clist_remove_head(&rio->idle_write_buffers)) || (b = clist_remove_head(&rio->busy_write_buffers))) {