rtph264pay/rtph265pay: Fix use after free

We can't assume a buffer that has been pushed in the adapter is still
valid. This fixes a use after free detect when running test on jenkins.
6 jobs for rtph265pay-fix-use-after-free in 26 minutes and 33 seconds (queued for 3 seconds)