vf_fingerprint: fix an obvious memory leak

Leaks the entire zimg state on filter deinit. Not sure what I was
thinking; with some luck, I just didn't give a shit about this case, but
most likely I was thinking the same thing as always: nothing.
This commit is contained in:
wm4 2019-10-03 01:07:25 +02:00
parent 5f75365f44
commit c669a434f3
1 changed files with 12 additions and 4 deletions

View File

@ -74,6 +74,16 @@ struct priv {
void *zimg_tmp;
};
static void destroy_zimg(struct mp_filter *f)
{
struct priv *p = f->priv;
free(p->zimg_tmp);
p->zimg_tmp = NULL;
zimg_filter_graph_free(p->zimg_graph);
p->zimg_graph = NULL;
}
// (Other code internal to this filter also calls this to reset the frame list.)
static void f_reset(struct mp_filter *f)
{
@ -97,10 +107,7 @@ static void reinit_fmt(struct mp_filter *f, struct mp_image *mpi)
p->last_w = mpi->w;
p->last_h = mpi->h;
free(p->zimg_tmp);
p->zimg_tmp = NULL;
zimg_filter_graph_free(p->zimg_graph);
p->zimg_graph = NULL;
destroy_zimg(f);
if (!(mpi->fmt.flags & (MP_IMGFLAG_YUV_NV | MP_IMGFLAG_YUV_P)))
return;
@ -255,6 +262,7 @@ static const struct mp_filter_info filter = {
.process = f_process,
.command = f_command,
.reset = f_reset,
.destroy = destroy_zimg,
.priv_size = sizeof(struct priv),
};