avcodec/pthread: check packet buffer allocation

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>