[FFmpeg-cvslog] avio: Check for memory allocation failure of private data
Derek Buitenhuis
git at videolan.org
Sun Oct 27 20:15:48 CET 2013
ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Tue Oct 22 20:22:13 2013 +0100| [d206fd996bdaa501e341d9397cff8529b38a9ad9] | committer: Derek Buitenhuis
avio: Check for memory allocation failure of private data
Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d206fd996bdaa501e341d9397cff8529b38a9ad9
---
libavformat/avio.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 2c7a35e..10f6a66 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();
More information about the ffmpeg-cvslog
mailing list