mirror of
https://github.com/mpv-player/mpv
synced 2025-02-23 00:06:56 +00:00
video/filter: fix option parser memory leak
This happens only if an option actually allocates memory (like strings). Change filter API such that vf->priv is free'd by vf.c instead by the filters. vf.c will free the option values as well.
This commit is contained in:
parent
f569d245ba
commit
b0a60b7321
@ -501,6 +501,9 @@ void vf_uninit_filter(vf_instance_t *vf)
|
||||
if (vf->uninit)
|
||||
vf->uninit(vf);
|
||||
vf_forget_frames(vf);
|
||||
const m_struct_t *st = vf->info->opts;
|
||||
if (st)
|
||||
m_struct_free(st, vf->priv);
|
||||
talloc_free(vf);
|
||||
}
|
||||
|
||||
|
@ -352,8 +352,6 @@ static void uninit(struct vf_instance *vf)
|
||||
{
|
||||
if (!vf->priv) return;
|
||||
av_free(vf->priv->buf);
|
||||
free(vf->priv);
|
||||
vf->priv = NULL;
|
||||
}
|
||||
|
||||
static int vf_open(vf_instance_t *vf, char *args)
|
||||
|
@ -310,7 +310,6 @@ static void uninit(struct vf_instance *vf)
|
||||
if (!vf->priv)
|
||||
return;
|
||||
destroy_graph(vf);
|
||||
free(vf->priv);
|
||||
}
|
||||
|
||||
static int vf_open(vf_instance_t *vf, char *args)
|
||||
|
@ -506,7 +506,6 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){
|
||||
|
||||
static void uninit(struct vf_instance *vf){
|
||||
if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
|
||||
free(vf->priv);
|
||||
}
|
||||
|
||||
static int vf_open(vf_instance_t *vf, char *args){
|
||||
|
@ -394,15 +394,9 @@ static int query_format(struct vf_instance *vf, unsigned int fmt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void uninit(vf_instance_t *vf)
|
||||
{
|
||||
free(vf->priv);
|
||||
}
|
||||
|
||||
static int vf_open(vf_instance_t *vf, char *args)
|
||||
{
|
||||
vf->config = config;
|
||||
vf->uninit = uninit;
|
||||
vf->filter = filter;
|
||||
vf->query_format = query_format;
|
||||
|
||||
|
@ -141,16 +141,10 @@ static int control(vf_instance_t *vf, int request, void *data)
|
||||
return vf_next_control(vf, request, data);
|
||||
}
|
||||
|
||||
static void uninit(struct vf_instance *vf)
|
||||
{
|
||||
free(vf->priv);
|
||||
}
|
||||
|
||||
static int vf_open(vf_instance_t *vf, char *args)
|
||||
{
|
||||
vf->config = config;
|
||||
vf->query_format = query_format;
|
||||
vf->uninit = uninit;
|
||||
vf->control = control;
|
||||
vf->filter = filter;
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user