[FFmpeg-devel] [PATCH] scale: fix leak occurring when a scale filter is reconfigured
Michael Niedermayer
michaelni at gmx.at
Mon May 2 12:45:17 CEST 2011
On Mon, May 02, 2011 at 12:37:35PM +0200, Stefano Sabatini wrote:
> This currently only occurrs in vsrc_buffer in case of mid-stream
> size/format change.
>
> Fix trac issue #124.
> ---
> libavfilter/vf_scale.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index da84efc..9ff93bd 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -214,14 +214,18 @@ static int config_props(AVFilterLink *outlink)
>
> scale->input_is_pal = av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PAL;
>
> - if(scale->sws)
> + if (scale->sws)
> sws_freeContext(scale->sws);
> scale->sws = sws_getContext(inlink ->w, inlink ->h, inlink ->format,
> outlink->w, outlink->h, outlink->format,
> scale->flags, NULL, NULL, NULL);
> + if (scale->isws[0])
> + sws_freeContext(scale->isws[0]);
> scale->isws[0] = sws_getContext(inlink ->w, inlink ->h/2, inlink ->format,
> outlink->w, outlink->h/2, outlink->format,
> scale->flags, NULL, NULL, NULL);
sws_getCachedContext() could maybe be used
but your patch is ok too
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110502/5817a36e/attachment.asc>
More information about the ffmpeg-devel
mailing list