[FFmpeg-devel] [PATCH] lavd/lavfi: fix two memleaks.

Michael Niedermayer michaelni at gmx.at
Fri Dec 16 22:38:09 CET 2011

On Fri, Dec 16, 2011 at 09:54:52PM +0100, Nicolas George wrote:
> Le sextidi 26 frimaire, an CCXX, Michael Niedermayer a écrit :
> > this might lead to use after free in sink_buffer.c if iam not misssing
> > anything
> I looked into it before submitting, and I think that sink_buffer will not
> use it after init(), which is called by avfilter_graph_config. And valgrind
> did not show new errors after the new free.

My concern is that we pass a pointer into sink_buffer which keeps it
and uses it in an exported function (its query_formats() that gets
called by avfilter_graph_config())
and we free it outside while sink_buffer retains this now invalid

AFAIK nothing calls query_formats() again and
nothing uses that pointer except query_formats(). But i think it
would be better if this pointer was set to NULL once it becomes
unavailable or if it would be freed only once sink_buffer is freed

> Stefano may be more competent to check this is correct.

It would be great if stefano could comment too


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato
-------------- 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/20111216/b98edb4c/attachment.asc>

More information about the ffmpeg-devel mailing list