summaryrefslogtreecommitdiff
path: root/libavcodec/pthread_frame.c
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2013-11-24 21:50:19 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-25 02:22:43 +0100
commit841c0aafa570871fd829f265502a3a185e3d5100 (patch)
treeb75993194c74dd0d27468922477b472cb1581d6c /libavcodec/pthread_frame.c
parenteff2edae562096c1e21e8c048392ffe8968181f2 (diff)
avcodec/pthread: check packet buffer allocation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pthread_frame.c')
-rw-r--r--libavcodec/pthread_frame.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 4f9d68b77b..6af05e2729 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -343,6 +343,10 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
p->avpkt.buf = av_buffer_ref(avpkt->buf);
else {
av_fast_malloc(&p->buf, &p->allocated_buf_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!p->buf) {
+ pthread_mutex_unlock(&p->mutex);
+ return AVERROR(ENOMEM);
+ }
p->avpkt.data = p->buf;
memcpy(p->buf, avpkt->data, avpkt->size);
memset(p->buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);