summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-11-16 17:30:28 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2011-11-21 10:18:25 -0500
commita8fe9a7242cfc7351957c0ec086d0722b2a653da (patch)
treeee2c3d8d03e100744cb6c00022cebc4a7fa1575a
parent03f30c837ba5f55e5bd98d32618173e8cd77e587 (diff)
downloadffmpeg-streaming-a8fe9a7242cfc7351957c0ec086d0722b2a653da.zip
ffmpeg-streaming-a8fe9a7242cfc7351957c0ec086d0722b2a653da.tar.gz
pthread: add some malloc failure checks
-rw-r--r--libavcodec/pthread.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 9fe9b8d..42b82a5 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -719,6 +719,11 @@ static int frame_thread_init(AVCodecContext *avctx)
p->parent = fctx;
p->avctx = copy;
+ if (!copy) {
+ err = AVERROR(ENOMEM);
+ goto error;
+ }
+
*copy = *src;
copy->thread_opaque = p;
copy->pkt = &p->avpkt;
@@ -732,6 +737,10 @@ static int frame_thread_init(AVCodecContext *avctx)
update_context_from_thread(avctx, copy, 1);
} else {
copy->priv_data = av_malloc(codec->priv_data_size);
+ if (!copy->priv_data) {
+ err = AVERROR(ENOMEM);
+ goto error;
+ }
memcpy(copy->priv_data, src->priv_data, codec->priv_data_size);
copy->internal = av_malloc(sizeof(AVCodecInternal));
if (!copy->internal) {
OpenPOWER on IntegriCloud