aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-02-05 15:09:52 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-06 01:01:33 +0100
commit1e5cfad57e88d168f50794e1523abfa477ad9aed (patch)
tree3eaf512cee2903e6f5ad67b63e0729fe0fdf504a /libavcodec
parente57fd926b09156fd8da42876e8946490025c47d4 (diff)
downloadffmpeg-1e5cfad57e88d168f50794e1523abfa477ad9aed.tar.gz
avcodec/pthread_frame: Check av_packet_ref() for failure
Fixes CID1396242
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pthread_frame.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index cb6d76284e..272587f53c 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -312,6 +312,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
FrameThreadContext *fctx = p->parent;
PerThreadContext *prev_thread = fctx->prev_thread;
const AVCodec *codec = p->avctx->codec;
+ int ret;
if (!avpkt->size && !(codec->capabilities & AV_CODEC_CAP_DELAY))
return 0;
@@ -337,7 +338,12 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
}
av_packet_unref(&p->avpkt);
- av_packet_ref(&p->avpkt, avpkt);
+ ret = av_packet_ref(&p->avpkt, avpkt);
+ if (ret < 0) {
+ pthread_mutex_unlock(&p->mutex);
+ av_log(p->avctx, AV_LOG_ERROR, "av_packet_ref() failed in submit_packet()\n");
+ return ret;
+ }
p->state = STATE_SETTING_UP;
pthread_cond_signal(&p->input_cond);