[FFmpeg-cvslog] avcodec/pthread: check packet buffer allocation

Hendrik Leppkes git at videolan.org
Mon Nov 25 02:29:40 CET 2013


ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Sun Nov 24 21:50:19 2013 +0100| [841c0aafa570871fd829f265502a3a185e3d5100] | committer: Michael Niedermayer

avcodec/pthread: check packet buffer allocation

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=841c0aafa570871fd829f265502a3a185e3d5100
---

 libavcodec/pthread_frame.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 4f9d68b..6af05e2 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);



More information about the ffmpeg-cvslog mailing list