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.
This commit is contained in:
wm4 2013-05-26 17:10:32 +02:00
parent f55f99ce19
commit 3edb8fb71c
1 changed files with 1 additions and 9 deletions

View File

@ -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 :(
}