[FFmpeg-devel] Patch: explicitly initialize AVFormatContext *ic = NULL
Michael Niedermayer
michaelni
Sat Jul 11 04:46:09 CEST 2009
On Fri, Jul 10, 2009 at 11:55:57AM -0700, Art Clarke wrote:
> On Thu, Jul 9, 2009 at 7:41 PM, avcoder <ffmpeg at gmail.com> wrote:
>
> > >> But IMHO, Initialize AVForamatContext *ic = NULL is a safe coding
> > >> style, and this modification unifies coding style with other
> > >> av_open_input_file() usages in ffmpeg internal source code
> > >
> > > The problem is that =NULL is in the applications (ffmpeg/ffplay/...)
> > > and the ABI/API does not seem to require it, adding that requirement
> > > makes libav incompatible with old applications ...
> >
> > I see, so revert is a better choice
>
>
>
> Or, actually special case the original problem; a caller has pre-allocated a
> context and passed it in (wherein av_open_input_file assumes memory
> ownership). Patch attached.
>
> - Art
>
> --
> http://www.xuggle.com/
> xu?ggle (z?' gl) v. To freely encode, decode, and experience audio and
> video.
>
> Use Xuggle to get the power of FFmpeg in Java.
> Index: libavformat/utils.c
> ===================================================================
> --- libavformat/utils.c (revision 19394)
> +++ libavformat/utils.c (working copy)
> @@ -499,7 +499,10 @@
> av_freep(&pd->buf);
> if (pb)
> url_fclose(pb);
> - av_freep(ic_ptr);
> + if (ap && ap->prealloced_context)
> + av_freep(ic_ptr);
> + else
> + *ic_ptr = NULL;
if()
av_free()
=NULL
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> ... defining _GNU_SOURCE...
For the love of all that is holy, and some that is not, don't do that.
-- Luca & Mans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090711/25b85332/attachment.pgp>
More information about the ffmpeg-devel
mailing list