summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-03 01:07:25 +0200
committerwm4 <wm4@nowhere>2019-10-03 01:07:25 +0200
commitc669a434f3cb720868ed9aaf4af8d9fddb203d64 (patch)
tree0ab7411021e0e1d186c1ae17d23427adb4bfb04d
parent5f75365f445e3de325ad0db81c5d9084f339cc6e (diff)
downloadmpv-c669a434f3cb720868ed9aaf4af8d9fddb203d64.tar.bz2
mpv-c669a434f3cb720868ed9aaf4af8d9fddb203d64.tar.xz
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.
-rw-r--r--video/filter/vf_fingerprint.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/video/filter/vf_fingerprint.c b/video/filter/vf_fingerprint.c
index 6a6f7ab812..7061b74c3c 100644
--- a/video/filter/vf_fingerprint.c
+++ b/video/filter/vf_fingerprint.c
@@ -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),
};