Browse Source

Free I/O buffers when we are finished with them!

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
6006bed530
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      src/core/posix_io.c

+ 4
- 1
src/core/posix_io.c View File

@@ -78,6 +78,7 @@ static void posix_file_free ( struct refcnt *refcnt ) {
78 78
 	struct io_buffer *tmp;
79 79
 
80 80
 	list_for_each_entry_safe ( iobuf, tmp, &file->data, list ) {
81
+		list_del ( &iobuf->list );
81 82
 		free_iob ( iobuf );
82 83
 	}
83 84
 	free ( file );
@@ -279,8 +280,10 @@ ssize_t read_user ( int fd, userptr_t buffer, off_t offset, size_t max_len ) {
279 280
 			copy_to_user ( buffer, offset, iobuf->data,
280 281
 				       frag_len );
281 282
 			iob_pull ( iobuf, frag_len );
282
-			if ( ! iob_len ( iobuf ) )
283
+			if ( ! iob_len ( iobuf ) ) {
284
+				list_del ( &iobuf-> list );
283 285
 				free_iob ( iobuf );
286
+			}
284 287
 			file->pos += frag_len;
285 288
 			len += frag_len;
286 289
 			offset += frag_len;

Loading…
Cancel
Save