Commit 4e93f00b authored by Timo Rothenpieler's avatar Timo Rothenpieler

avcodec/nvenc: check pop_context return value

parent 15b019e4
...@@ -1293,7 +1293,7 @@ static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx) ...@@ -1293,7 +1293,7 @@ static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx)
static av_cold int nvenc_setup_surfaces(AVCodecContext *avctx) static av_cold int nvenc_setup_surfaces(AVCodecContext *avctx)
{ {
NvencContext *ctx = avctx->priv_data; NvencContext *ctx = avctx->priv_data;
int i, res; int i, res = 0, res2;
ctx->surfaces = av_mallocz_array(ctx->nb_surfaces, sizeof(*ctx->surfaces)); ctx->surfaces = av_mallocz_array(ctx->nb_surfaces, sizeof(*ctx->surfaces));
if (!ctx->surfaces) if (!ctx->surfaces)
...@@ -1320,17 +1320,15 @@ static av_cold int nvenc_setup_surfaces(AVCodecContext *avctx) ...@@ -1320,17 +1320,15 @@ static av_cold int nvenc_setup_surfaces(AVCodecContext *avctx)
for (i = 0; i < ctx->nb_surfaces; i++) { for (i = 0; i < ctx->nb_surfaces; i++) {
if ((res = nvenc_alloc_surface(avctx, i)) < 0) if ((res = nvenc_alloc_surface(avctx, i)) < 0)
{ goto fail;
nvenc_pop_context(avctx);
return res;
}
} }
res = nvenc_pop_context(avctx); fail:
if (res < 0) res2 = nvenc_pop_context(avctx);
return res; if (res2 < 0)
return res2;
return 0; return res;
} }
static av_cold int nvenc_setup_extradata(AVCodecContext *avctx) static av_cold int nvenc_setup_extradata(AVCodecContext *avctx)
......
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