encoder: fix invalid free of raw buffers

Return current input buffer as buffer to be freed in case
of errors that are seen before picking up the input buffer
to be from the input queue.
Once a buffer is picked up from the queue, that is returned
as the buffer to be freed.

There is no need to return a buffer from ps_proc context

Bug: 180643802

Test: poc in the bug description
Test: atest CtsMediaV2TestCases:CodecEncoderTest
Test: atest VtsHalMediaC2V1_0TargetVideoEncTest

Change-Id: I1671ca1e82f522004d1f070df89b256b856f75b8
(cherry picked from commit 3e73f0d56298ba6256927928669d0cc6e4b1c9ee)
1 file changed