[FFmpeg-devel] [PATCH 01/11] avformat/mov: Use ff_alloc_extradata for dvdsub extradata
Michael Niedermayer
michael at niedermayer.cc
Thu Dec 12 19:50:25 EET 2019
On Wed, Dec 11, 2019 at 04:03:12PM +0800, mypopy at gmail.com wrote:
> On Wed, Dec 11, 2019 at 6:00 AM Andreas Rheinhardt
> <andreas.rheinhardt at gmail.com> wrote:
> >
> > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> > ---
> > libavformat/mov.c | 11 ++++-------
> > 1 file changed, 4 insertions(+), 7 deletions(-)
> >
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index 7553a7fdfc..733f4e4a34 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -2255,7 +2255,7 @@ static int mov_rewrite_dvd_sub_extradata(AVStream *st)
> > {
> > char buf[256] = {0};
> > uint8_t *src = st->codecpar->extradata;
> > - int i;
> > + int i, ret;
> >
> > if (st->codecpar->extradata_size != 64)
> > return 0;
> > @@ -2275,12 +2275,9 @@ static int mov_rewrite_dvd_sub_extradata(AVStream *st)
> > if (av_strlcat(buf, "\n", sizeof(buf)) >= sizeof(buf))
> > return 0;
> >
> > - av_freep(&st->codecpar->extradata);
> > - st->codecpar->extradata_size = 0;
> > - st->codecpar->extradata = av_mallocz(strlen(buf) + AV_INPUT_BUFFER_PADDING_SIZE);
> > - if (!st->codecpar->extradata)
> > - return AVERROR(ENOMEM);
> > - st->codecpar->extradata_size = strlen(buf);
> > + ret = ff_alloc_extradata(st->codecpar, strlen(buf));
> > + if (ret < 0)
> > + return ret;
> > memcpy(st->codecpar->extradata, buf, st->codecpar->extradata_size);
> >
> > return 0;
> > --
> > 2.20.1
> >
> LGTM
will apply
[...]
--
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: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191212/b386939f/attachment.sig>
More information about the ffmpeg-devel
mailing list