diff options
Diffstat (limited to 'libhb/fifo.c')
-rw-r--r-- | libhb/fifo.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libhb/fifo.c b/libhb/fifo.c index 3aeeea273..a29e84696 100644 --- a/libhb/fifo.c +++ b/libhb/fifo.c @@ -202,14 +202,19 @@ void hb_buffer_close( hb_buffer_t ** _b ) return; } /* either the pool is full or this size doesn't use a pool - free the buf */ - if( b->data ) + while( b ) { - free( b->data ); - hb_lock(buffers.lock); - buffers.allocated -= b->alloc; - hb_unlock(buffers.lock); + hb_buffer_t * next = b->next; + if( b->data ) + { + free( b->data ); + hb_lock(buffers.lock); + buffers.allocated -= b->alloc; + hb_unlock(buffers.lock); + } + free( b ); + b = next; } - free( b ); *_b = NULL; } |