avfilter/curves: fix resource leaks.

Fixes CID1206650
Try mov tags if the fourcc in V_MS/VFW mkv files cannot be found in bmp tags.

Fixes decoding of broken mkv files containing ProRes video from ticket #3434.