[FFmpeg-devel] [PATCH v1] avcodec/libvpxenc: fix potential memory leak.
Wonkap Jang
wonkap at google.com
Tue Feb 16 08:37:32 EET 2021
While parsing ref_frame_config, AVdictionary needs to be manually
deallocated.
---
libavcodec/libvpxenc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 284cb9a108..941c3fdd88 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1595,6 +1595,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
if (en) {
if (avctx->codec_id == AV_CODEC_ID_VP9) {
AVDictionaryEntry* en2 = NULL;
+ ctx->vpx_ref_frame_config = NULL;
av_dict_parse_string(&ctx->vpx_ref_frame_config, en->value, "=", ":", 0);
while ((en2 = av_dict_get(ctx->vpx_ref_frame_config, "", en2, AV_DICT_IGNORE_SUFFIX))) {
@@ -1604,6 +1605,8 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
en2->key, en2->value);
}
+ if (ctx->vpx_ref_frame_config)
+ av_dict_free(&ctx->vpx_ref_frame_config);
codecctl_intp(avctx, VP9E_SET_SVC_REF_FRAME_CONFIG, (int *)&ctx->ref_frame_config);
} else {
av_log(avctx, AV_LOG_WARNING,
--
2.30.0.478.g8a0d178c01-goog
More information about the ffmpeg-devel
mailing list