diff options
author | Michael Brown | 2007-05-25 18:01:31 +0200 |
---|---|---|
committer | Michael Brown | 2007-05-25 18:01:31 +0200 |
commit | 6006bed530b41e51e9ceccb04849a290496c6bfd (patch) | |
tree | b57c2b2b9b26a83033ad6fa7a4fcbe1dbe539c1d /src/core/posix_io.c | |
parent | Use list_for_each_entry_safe() when flushing queue. (diff) | |
download | ipxe-6006bed530b41e51e9ceccb04849a290496c6bfd.tar.gz ipxe-6006bed530b41e51e9ceccb04849a290496c6bfd.tar.xz ipxe-6006bed530b41e51e9ceccb04849a290496c6bfd.zip |
Free I/O buffers when we are finished with them!
Diffstat (limited to 'src/core/posix_io.c')
-rw-r--r-- | src/core/posix_io.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/posix_io.c b/src/core/posix_io.c index b98766f8..6cefbf7b 100644 --- a/src/core/posix_io.c +++ b/src/core/posix_io.c @@ -78,6 +78,7 @@ static void posix_file_free ( struct refcnt *refcnt ) { struct io_buffer *tmp; list_for_each_entry_safe ( iobuf, tmp, &file->data, list ) { + list_del ( &iobuf->list ); free_iob ( iobuf ); } free ( file ); @@ -279,8 +280,10 @@ ssize_t read_user ( int fd, userptr_t buffer, off_t offset, size_t max_len ) { copy_to_user ( buffer, offset, iobuf->data, frag_len ); iob_pull ( iobuf, frag_len ); - if ( ! iob_len ( iobuf ) ) + if ( ! iob_len ( iobuf ) ) { + list_del ( &iobuf-> list ); free_iob ( iobuf ); + } file->pos += frag_len; len += frag_len; offset += frag_len; |