]> git.sesse.net Git - ffmpeg/commit
avformat/mpegenc: Fix memleaks and return values
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 16 Oct 2019 16:47:39 +0000 (18:47 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 17 Oct 2019 16:04:37 +0000 (18:04 +0200)
commitb288a7eb3d963a175e177b6219c8271076ee8590
tree30c2dcf264f90f48edbadafb5abe4bf7e61b16ad
parent39d5acbd097b86a3ab8232a0156a18bf8d8a71ef
avformat/mpegenc: Fix memleaks and return values

If there is an error in mpeg_mux_init() (the write_header function of
the various MPEG-PS muxers), two things might happen:

1. Several fifos might leak. Instead of freeing them, the goto fail part
of the functions freed the private data of the AVStreams instead,
although this will be freed later in free_stream() anyway.
2. And if the function is exited via goto fail, it automatically
returned AVERROR(ENOMEM), although this is also used when the error is
not a memory allocation failure.

Both of these issues happened in ticket #8284 and have been fixed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mpegenc.c