There is a chance that pool->buffers[index] sets BUFFER_STATE_QUEUED, but it has not been queued yet which makes pool->buffers[index] still NULL. At this time, if pool_streamff release all buffers with BUFFER_STATE_QUEUED state regardless of whether the buffer is NULL or not, it will cause segfault. To fix this, also check buffer when streamoff release buffer. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1842>