v4l2: free all queued buffers

Don't just loop over the first num_queued buffers but loop over
all the buffers and check if they need to be freed. It is possible that
not all buffers are queued and then the entry in our array will be NULL.
Those buffers that are not queued were freed in stop().

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=696651
This commit is contained in:
Wim Taymans 2013-04-03 11:09:50 +02:00
parent 0dfc88d893
commit 14300e5805

View file

@ -524,8 +524,9 @@ 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_queued; n++) {
gst_v4l2_buffer_pool_free_buffer (bpool, pool->buffers[n]);
for (n = 0; n < pool->num_buffers; n++) {
if (pool->buffers[n])
gst_v4l2_buffer_pool_free_buffer (bpool, pool->buffers[n]);
}
pool->num_queued = 0;
g_free (pool->buffers);