doc/examples/extract_mvs: fix memory leak in codec context initialization

Ensure the allocated AVCodecContext is properly freed if avcodec_parameters_to_context fails.

Signed-off-by: 0xBat <monsterbat02@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
0xBat
2026-01-05 02:11:42 +01:00
committed by Michael Niedermayer
parent 786e245e80
commit f59968720c

View File

@@ -109,6 +109,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
ret = avcodec_parameters_to_context(dec_ctx, st->codecpar);
if (ret < 0) {
fprintf(stderr, "Failed to copy codec parameters to codec context\n");
avcodec_free_context(&dec_ctx);
return ret;
}