[FFmpeg-devel] [PATCH 3/4] avio: Check for memory allocation failure of private data

Michael Niedermayer michaelni at gmx.at
Fri Oct 25 12:58:31 CEST 2013


On Tue, Oct 22, 2013 at 09:33:58PM +0100, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libavformat/avio.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index 2c7a35e..558e3e8 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -143,6 +143,10 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
>      uc->max_packet_size = 0; /* default: stream file */
>      if (up->priv_data_size) {
>          uc->priv_data = av_mallocz(up->priv_data_size);
> +        if (!uc->priv_data) {
> +            err = AVERROR(ENOMEM);
> +            goto fail;
> +        }

this probably leaks uc

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131025/ee601c50/attachment.asc>


More information about the ffmpeg-devel mailing list