fix memleaks in filter_{dec|enc}ode