avfilter/curves: fix resource leaks.

Fixes CID1206650
avcodec/shorten: check bitshift

Fixes invalid shift
Fixes CID1194400

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