[FFmpeg-devel] [PATCH 5/5] lavu/utils: check for malloc failure

Michael Niedermayer michaelni at gmx.at
Fri Dec 12 20:21:32 CET 2014


On Fri, Dec 12, 2014 at 06:15:43PM +0100, wm4 wrote:
> ---
>  libavformat/utils.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 5a2a72d..fc582b7 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -3652,6 +3652,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
>      st->info->last_dts = AV_NOPTS_VALUE;
>  
>      st->codec = avcodec_alloc_context3(c);
> +    if (!st->codec) {
> +        av_free(st);
> +        return NULL;
> +    }

this would leak st->info

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141212/4d01261a/attachment.asc>


More information about the ffmpeg-devel mailing list