[FFmpeg-devel] [PATCH] avcodec/pthread: check packet buffer allocation
Hendrik Leppkes
h.leppkes at gmail.com
Sun Nov 24 21:50:19 CET 2013
---
libavcodec/pthread_frame.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index b450be6..342a628 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -345,6 +345,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);
--
1.8.4.msysgit.0
More information about the ffmpeg-devel
mailing list