avfilter/curves: fix resource leaks.

Fixes CID1206650