From patchwork Sat Sep 26 10:28:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22614 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 8E07544A10F for ; Sat, 26 Sep 2020 13:30:23 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 73A4D68B7A4; Sat, 26 Sep 2020 13:30:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B539768B736 for ; Sat, 26 Sep 2020 13:30:17 +0300 (EEST) Received: by mail-wm1-f52.google.com with SMTP id q9so1720699wmj.2 for ; Sat, 26 Sep 2020 03:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KCr34Gr72yt3wMGh6lb+u+NLEQIqZ8I4hbDsGZ0Xe4U=; b=IsGNgQEiHJvh/QANSwNglwAgSSSZz4yxcirx140LfhHR+biJJ4ZPg9Jr2P3Sidkbap +0rqOeNwP7NEKF1bgO2pDhMUt1D/Uon+WINvMwnK3HxQinfKGtq7VCGWWxcdXvGCBoD4 6UqN2jTsdjsxjVvQBcNziiFOFe+/teEAS+dkhl2vB63LShJTAWdpP4+0rvy2ffbb9OBg eU5bQEfuQ+p7iNSHvsZcIO4wsEU1Mlx8MIjbxPCtPFroUoZfyodfk6X0eyOlDNenFiV1 0OTC5s+AFhDcnG8E1W4WWNct3tIsXFFaqU5ReLulCiL7jawODos4vr8+KGrdOj7blO3K MXpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KCr34Gr72yt3wMGh6lb+u+NLEQIqZ8I4hbDsGZ0Xe4U=; b=NCP9fEGB/n4XzhWe6qauqMMmevsqJ33GYsUB8E66IKktnXX7Ki0zVdphbCa5QfJNbo rmteBSO9NXkMHe5yUGbJVrRLQT8Iys3YIX6Ybimmx591cFTOupyqb0aJZGUYkwxn+/dN nbCWvaX7QYpiLPGvXyY58K/yDpa0H7yQJ5TV03quIEewtTkUdsV+egJGYXwi3pACkdYy HkpvTiGIukxJ77vKM2tU48/RiEtqFtblC54L/YkiQoDNoap7QzIvaLn9haiEQiRzOiQy plFyq0+lFVU5a+m3IHBhGLCrB3WAhlPfq2tbW5vnBrXnNeJC1hb99/nuB7LKNa3clooF mrSQ== X-Gm-Message-State: AOAM530BRV2xmgySxj1WxjQIH9NI4ZtbLKF3KzHumh5ZmxSeESunZ55t QhD813RxznfC/YUsjgapvbNApT0dIEM= X-Google-Smtp-Source: ABdhPJzo/tgQc1yc6aAJeM/Al9i7q/GsFMStKIp92vBORYVaalx4pe+5oM9E3al8YVuaDDx6NLyi4A== X-Received: by 2002:a1c:81c9:: with SMTP id c192mr1990221wmd.2.1601116217085; Sat, 26 Sep 2020 03:30:17 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k8sm6064867wrl.42.2020.09.26.03.30.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 03:30:16 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 26 Sep 2020 12:28:01 +0200 Message-Id: <20200926102804.228089-22-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926102804.228089-1-andreas.rheinhardt@gmail.com> References: <20200926102804.228089-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 22/25] avcodec/utils: Also free encoder extradata on avcodec_open2() error 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" It is owned by libavcodec for encoders. Signed-off-by: Andreas Rheinhardt --- libavcodec/utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 05064b560f..a976ceb260 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1034,11 +1034,15 @@ free_and_end: av_opt_free(avctx->priv_data); av_opt_free(avctx); + if (av_codec_is_encoder(avctx->codec)) { #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS av_frame_free(&avctx->coded_frame); FF_ENABLE_DEPRECATION_WARNINGS #endif + av_freep(&avctx->extradata); + avctx->extradata_size = 0; + } av_dict_free(&tmp); av_freep(&avctx->priv_data);