v4l2videodec: ensure pool exists before orphaning it
authorJames Cowgill <james.cowgill@thinci.com>
Tue, 29 Oct 2019 14:05:48 +0000 (14:05 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 29 Oct 2019 22:08:58 +0000 (22:08 +0000)
commit061ea44185f7f5555af412f2875542e57829fd81
tree2809e5c571dfa3a94c6256add74b602150792c75
parent0141c2f010574165b3b12be51e395778d39a6640
v4l2videodec: ensure pool exists before orphaning it

In commit e2ff87732d0b ("v4l2videodec: support orphaning") support for
orphaning the capture buffer pool was added when the format is
renegotiated. However, the commit forgot to check that a pool existed
before doing this. This is needed because it's possible for the format
to be renegotiated before a capture pool is allocated, which would
result in trying to orphan a NULL pool and lead to a NULL pointer
dereference.

Fix this by checking a pool exists first. If the pool doesn't exist,
there are no buffers to be reclaimed, so skip the allocation query in
that case.
sys/v4l2/gstv4l2videodec.c