Commit a8fe9a72 authored by Justin Ruggles's avatar Justin Ruggles

pthread: add some malloc failure checks

parent 03f30c83
...@@ -719,6 +719,11 @@ static int frame_thread_init(AVCodecContext *avctx) ...@@ -719,6 +719,11 @@ static int frame_thread_init(AVCodecContext *avctx)
p->parent = fctx; p->parent = fctx;
p->avctx = copy; p->avctx = copy;
if (!copy) {
err = AVERROR(ENOMEM);
goto error;
}
*copy = *src; *copy = *src;
copy->thread_opaque = p; copy->thread_opaque = p;
copy->pkt = &p->avpkt; copy->pkt = &p->avpkt;
...@@ -732,6 +737,10 @@ static int frame_thread_init(AVCodecContext *avctx) ...@@ -732,6 +737,10 @@ static int frame_thread_init(AVCodecContext *avctx)
update_context_from_thread(avctx, copy, 1); update_context_from_thread(avctx, copy, 1);
} else { } else {
copy->priv_data = av_malloc(codec->priv_data_size); 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); memcpy(copy->priv_data, src->priv_data, codec->priv_data_size);
copy->internal = av_malloc(sizeof(AVCodecInternal)); copy->internal = av_malloc(sizeof(AVCodecInternal));
if (!copy->internal) { if (!copy->internal) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment