[FFmpeg-cvslog] movenc: Fix unfreed memory found by valgrind.
Clément Bœsch
ubitux at gmail.com
Wed Aug 8 23:08:46 CEST 2012
On Sun, Aug 05, 2012 at 07:54:25PM +0200, Reimar Döffinger wrote:
> On Sun, Aug 05, 2012 at 07:02:39PM +0200, Clément Bœsch wrote:
> > On Sun, Aug 05, 2012 at 05:28:20PM +0200, Philip Langdale wrote:
> > > ffmpeg | branch: master | Philip Langdale <philipl at overt.org> | Sun Aug 5 08:26:49 2012 -0700| [3eb56e8434e621273e16385fea4524516c95b6e6] | committer: Philip Langdale
> > >
> > > movenc: Fix unfreed memory found by valgrind.
> > >
> > > Signed-off-by: Philip Langdale <philipl at overt.org>
> > >
> > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3eb56e8434e621273e16385fea4524516c95b6e6
> > > ---
> > >
> > > libavformat/movenc.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > > index 1d24383..910b9d4 100644
> > > --- a/libavformat/movenc.c
> > > +++ b/libavformat/movenc.c
> > > @@ -3154,11 +3154,12 @@ static int mov_write_subtitle_end_packet(AVFormatContext *s,
> > > int stream_index,
> > > int64_t dts) {
> > > AVPacket end;
> > > + short data = 0;
> > > int ret;
> > >
> > > av_init_packet(&end);
> > > end.size = sizeof (short);
> > > - end.data = av_mallocz(end.size);
> > > + end.data = (char *)&data;
> > > end.pts = dts;
> > > end.dts = dts;
> > > end.duration = 0;
> >
> > Note: it might be wise to use uint16_t instead of short.
>
> Why not use char data[2] = {0, 0}; and avoid the cast while at it?
Indeed... changed.
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20120808/f364d14b/attachment.asc>
More information about the ffmpeg-cvslog
mailing list