diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2013-10-22 20:22:13 +0100 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2013-10-27 19:15:03 +0000 |
commit | d206fd996bdaa501e341d9397cff8529b38a9ad9 (patch) | |
tree | 702a81af8eb997ad9f4cfead9a5125d1797ff5ce /libavformat/avio.c | |
parent | 52aed19307ee0768b03a620005c4b2b5fda621c6 (diff) | |
download | ffmpeg-d206fd996bdaa501e341d9397cff8529b38a9ad9.tar.gz |
avio: Check for memory allocation failure of private data
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r-- | libavformat/avio.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c index 2c7a35eced..10f6a66ee4 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; + } if (up->priv_data_class) { int proto_len= strlen(up->name); char *start = strchr(uc->filename, ','); @@ -180,6 +184,9 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up, return 0; fail: *puc = NULL; + if (uc) + av_freep(&uc->priv_data); + av_freep(&uc); #if CONFIG_NETWORK if (up->flags & URL_PROTOCOL_FLAG_NETWORK) ff_network_close(); |