From patchwork Tue Sep 15 07:39:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22401 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 06B8A44B72B for ; Tue, 15 Sep 2020 10:43:00 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0912668BC5C; Tue, 15 Sep 2020 10:40:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1C5D568BA41 for ; Tue, 15 Sep 2020 10:40:47 +0300 (EEST) Received: by mail-wm1-f66.google.com with SMTP id e11so10464899wme.0 for ; Tue, 15 Sep 2020 00:40:47 -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=iqoJluXt6pbPB3FBKqQjhgbECUzH4kTswMDc4VcRq0E=; b=K/dNfV5BDJyIrrwFf2cIV2ygeGNB+v1dsQARzqp/5cf22pPd9IGUaPSguQILEti42t G3ygRV/esdJSmt/Txb4gVnWbhIGHd3ToLTTHpYOfwOaiAWASWvAp6+1cS9wKK2XVylhH 4dMKoRUFBvAvDm85+g/0U62mFWqX1yymT4EVacA/f8HQnr73JspC4t4rObooBcA3ptQh BXywrsprha4gBgOi6+UvgA9HHkAMq/n9pQgLNpY+f7HPMSKWUyg9Dp4NB+j9BVmU0l8s 9fngYtNE6sqkoBOXSCnVvIikk2ZNmkYxXQiTTCgHEJMVvKNwq5dxGMeMq6lCn4anDzxA 08yg== 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=iqoJluXt6pbPB3FBKqQjhgbECUzH4kTswMDc4VcRq0E=; b=VKOBRE3KnkXPlxsdiyHSokCzIfBmgGiDQ4cuRhOGjJjYXJEAY9WM4nlVqRzdFUKJfb OOh4xV3/FdfHut8wuIi3X5ZVoXC+ghaVdvlWX8nJE5hsQgDLbhKhxjLlNqe4ZjUFd6Gv Rb+pZT0vCYEvIA7PBTtMce7FaSje4JjUl/YOZbWUAw4oPX1LDkmUZ2s40VzA/fF09GTN JlT2yLq5dQLQEOhp2Khe1kVommYXw0RgLhQukQkBwSKOkqXn+2PQugpcOM+PaQ2a0VGq VveDw8wgFFYAjR1ZBq2i6hatvqOBNEL/beH+7+vM4W8yfzjjSA2Gh5IQGT1abmeRQ6Nb LWqg== X-Gm-Message-State: AOAM533anZ3rrGdqnmjlNVoiDvO+4lKee32suCkzgcAgIAKQv/2hdxoV tBRaN7SpWq6gzj+UxxQ4oSb+DzjigNU= X-Google-Smtp-Source: ABdhPJzK2x8f9SycXU9zs9xwQ2PI5JNixBwPhbOBahE78aqqeGOk/HEei3ihU68DKBwmdHfuGb7GeA== X-Received: by 2002:a1c:6254:: with SMTP id w81mr3181842wmb.94.1600155646301; Tue, 15 Sep 2020 00:40:46 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id d23sm6112125wmb.6.2020.09.15.00.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2020 00:40:45 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 15 Sep 2020 09:39:50 +0200 Message-Id: <20200915074000.102622-20-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200915074000.102622-1-andreas.rheinhardt@gmail.com> References: <20200915074000.102622-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 20/30] avcodec/mlpenc: Fix memleak upon init failure 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" If an error happens during init after an allocation has succeeded, the already allocated data leaked up until now. Fix this by setting the FF_CODEC_CAP_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavcodec/mlpenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c index 52ea06ed91..f6159d39c8 100644 --- a/libavcodec/mlpenc.c +++ b/libavcodec/mlpenc.c @@ -2391,6 +2391,7 @@ AVCodec ff_mlp_encoder = { .sample_fmts = (const enum AVSampleFormat[]) {AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE}, .supported_samplerates = (const int[]) {44100, 48000, 88200, 96000, 176400, 192000, 0}, .channel_layouts = ff_mlp_channel_layouts, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, }; #endif #if CONFIG_TRUEHD_ENCODER @@ -2407,5 +2408,6 @@ AVCodec ff_truehd_encoder = { .sample_fmts = (const enum AVSampleFormat[]) {AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE}, .supported_samplerates = (const int[]) {44100, 48000, 88200, 96000, 176400, 192000, 0}, .channel_layouts = (const uint64_t[]) {AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_5POINT0_BACK, AV_CH_LAYOUT_5POINT1_BACK, 0}, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, }; #endif