nvenc: Fix crash when nvenc was reused then freed without encoding
authorSeungha Yang <seungha.yang@navercorp.com>
Thu, 14 Nov 2019 10:00:51 +0000 (19:00 +0900)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 22 Nov 2019 03:02:57 +0000 (03:02 +0000)
commit0cf67c3be7b70f6da5a06a9a34f3621b9c3d9204
tree960d5cddabca3c208a60ba62b608081cbcdf0c87
parentaef414375a0798b91265f6551bdf57a532e0c1f5
nvenc: Fix crash when nvenc was reused then freed without encoding

GstNvBaseEnc::n_bufs was set from the previous encoding session
but it wasn't cleared after stop. That might result to invalid memory
access at the next start (no encoded data) and then stop sequence.
Instead of defining a variable for array length, use GArray::len
directly to avoid such confusion.
sys/nvcodec/gstnvbaseenc.c
sys/nvcodec/gstnvbaseenc.h