diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 038f0eb231..44c01e11c8 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -458,9 +458,8 @@ gst_v4l2_buffer_pool_stop (GstBufferPool * bpool) ret = GST_BUFFER_POOL_CLASS (parent_class)->stop (bpool); /* then free the remaining buffers */ - for (n = 0; n < pool->num_allocated; n++) { - if (pool->buffers[n]) - gst_v4l2_buffer_pool_free_buffer (bpool, pool->buffers[n]); + for (n = 0; n < pool->num_queued; n++) { + gst_v4l2_buffer_pool_free_buffer (bpool, pool->buffers[n]); } g_free (pool->buffers); pool->buffers = NULL;