aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2013-10-22 20:22:13 +0100
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2013-10-29 11:40:15 +0000
commit25c7db7cc99d74fe6fb56a6fd52c9b5f1591e448 (patch)
treef957da08236b5feec48afa46ee79fb0a518f71ac
parent327c439f811a89d774db9a86f72951d295193e5f (diff)
downloadffmpeg-25c7db7cc99d74fe6fb56a6fd52c9b5f1591e448.tar.gz
avio: Check for memory allocation failure of private data
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r--libavformat/avio.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index d9e5380274..e07b23609d 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -135,6 +135,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) {
*(const AVClass **)uc->priv_data = up->priv_data_class;
av_opt_set_defaults(uc->priv_data);
@@ -147,6 +151,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();