From patchwork Tue Feb 16 06:37:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wonkap Jang X-Patchwork-Id: 25653 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id EA6A8449E8C for ; Tue, 16 Feb 2021 08:37:42 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BBFE6689956; Tue, 16 Feb 2021 08:37:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 345B6680534 for ; Tue, 16 Feb 2021 08:37:36 +0200 (EET) Received: by mail-yb1-f201.google.com with SMTP id u3so12548345ybj.13 for ; Mon, 15 Feb 2021 22:37:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to; bh=yH7ayYOAmr8RJy936F0NKcC35FifDhHx/Y8pqtqK2dI=; b=EIouUwnzICklDP1TJarSt6nlAYp2pgSn9tfzdI1FdviLSxwglaLphdGU1mAI8tiBIl xYXpHq7i8e/FzptoEDsGQUQ6W2EwFgDUb9cdiJmxsmmVmed4qYTzkCnUlv3mG7TkBeM9 2bi/rQrK21s0YYpZq6CJhObA5L+NPbPfJZw8RymRJfCwI12ZVC2wiC3rI02nmeYK6ltk iaez0xecgLh3XPrV2D6+2a1yqEQawYbzxSRuNEp0Pql2+0Bu2/N/jAzFn+Y/VVMMPtni 5fr1VmNRIBHWDx8CDHpT2XGvHndiU2t4DK3aXgrIy+2UjMc+U9h2z2BfHgR8zfD1xquM oYpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to; bh=yH7ayYOAmr8RJy936F0NKcC35FifDhHx/Y8pqtqK2dI=; b=NE1UWWxIb80ve5X9Geu5nrimql7O/OXvcgRZLV7eMHt2n9G220OzXQYyJ4bfxCkLdL d7/Yz/rcILbQ4ZLbeoDB+WrSBD3DqYqThMnHKpG4d0BmSUqRUiFI4XJwEshXBW2V+y+T DWBlAFgz/8uP7MM48ddbm2LYSp6IprDWRQ0De63+MkAkKux+MwMxdAEuQhrSNVtzymEj OumRl1dJ/Uf//o4XvE6uE9N2kY7zI8eEL2V6kLhi7wXe/YZ/zKjGHo4+KHjQtMJH90mB OnAe90swmKG+hcT6ef/Eb7Fey7IsK+O6IIf8pQCxCbZwla3xSOLWykh/rT5W19zHYwJi FYcw== X-Gm-Message-State: AOAM533iRW/ecXtIlFaZm6Giv1bptIPB8MC5YC/fqf0SuDkeIwqzjcMM bFHMPsMJ13NItqtdyoZ8lrA9WpEuHP6ZjPHb4LsqCiClDwPGXit3Da9HW1asKakKyekJToTcbkQ b6IdJU7MCW9hENVRlcKv6VCm7DfVoerPpnZ8r/ZXkdfXddCqpv9RCuNuEcmFMum4= X-Google-Smtp-Source: ABdhPJxJa/nf2LElQNf93rGq9/Jbh8suVlPxLJfeHQXUfzcPSBGqdlFowJdFH1mNlhRQX80npi1l7f6TZJE= X-Received: from wonkap.kir.corp.google.com ([2620:15c:17:10:a5af:3d17:2d70:32f3]) (user=wonkap job=sendgmr) by 2002:a25:34d2:: with SMTP id b201mr30009162yba.149.1613457454441; Mon, 15 Feb 2021 22:37:34 -0800 (PST) Date: Mon, 15 Feb 2021 22:37:32 -0800 Message-Id: <20210216063732.2732477-1-wonkap@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog From: Wonkap Jang To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v1] avcodec/libvpxenc: fix potential memory leak. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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,