From 3edb8fb71c7bc38ad0b183d875c53d64e69a0e26 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 26 May 2013 17:10:32 +0200 Subject: vf_delogo: copy in non-direct case, fix double-free If the image is not writeable, the image actually has to be copied beforehand. This was overlooked when converting the video chain to reference counted images. Fix a double free issue. This was overlooked when vf.c was changed to free filter priv data automatically. --- video/filter/vf_delogo.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'video/filter') diff --git a/video/filter/vf_delogo.c b/video/filter/vf_delogo.c index 346eb468f5..d90d852057 100644 --- a/video/filter/vf_delogo.c +++ b/video/filter/vf_delogo.c @@ -179,6 +179,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) if (!mp_image_is_writeable(mpi)) { dmpi = vf_alloc_out_image(vf); mp_image_copy_attributes(dmpi, mpi); + mp_image_copy(dmpi, mpi); } if (vf->priv->timed_rect) @@ -195,13 +196,6 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) return dmpi; } -static void uninit(struct vf_instance *vf){ - if(!vf->priv) return; - - free(vf->priv); - vf->priv=NULL; -} - //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ @@ -290,7 +284,6 @@ static int vf_open(vf_instance_t *vf, char *args){ vf->config=config; vf->filter=filter; vf->query_format=query_format; - vf->uninit=uninit; if (vf->priv->file) { if (load_timed_rectangles(vf->priv)) @@ -305,7 +298,6 @@ static int vf_open(vf_instance_t *vf, char *args){ vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_420P); if(!vf->priv->outfmt) { - uninit(vf); return 0; // no csp match :( } -- cgit v1.2.3