]> mj.ucw.cz Git - libucw.git/commitdiff
Main recio: Fixed crashes when a second rec_io_add() followed rec_io_del().
authorPavel Charvat <pchar@ucw.cz>
Mon, 12 Feb 2018 11:17:52 +0000 (12:17 +0100)
committerPavel Charvat <pchar@ucw.cz>
Mon, 12 Feb 2018 11:17:52 +0000 (12:17 +0100)
ucw/main-rec.c

index f13758e3ecaa1a98af2665f60f8618846ef3724d..d3d4a589008ebd66688b9d84b9c8898ff6545deb 100644 (file)
@@ -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)))
     {