From patchwork Thu Oct 17 09:20:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 15811 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 68666448873 for ; Thu, 17 Oct 2019 12:20:18 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4271568A7EB; Thu, 17 Oct 2019 12:20:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9CB2C689ADA for ; Thu, 17 Oct 2019 12:20:11 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id o18so1429934wrv.13 for ; Thu, 17 Oct 2019 02:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=fhSptTEBrVI+GlmMSHhgsp3uZMybLem+Wlds/l5rEgw=; b=Z66lSZNULOVLXmeVolpJH7EYV2h7do7gNEWFZrEX7xxzfk7vebuHfs+KgMKnon3x8z P9Vo+IBfCliQIJL+ogcYXzPnjpL+3HNBBCVRbZjAlqeBStECTbiothTonA3ShcyiabPy iB6C0AhJNggMgPGBCMq1NHWM4kwIzsCtP2o1C7KFO+tQhOT+uGdjX+mMDkXBfYqlSG6I WdxOetvHBoFYtwK+qKlEEazO8nxLGlXpYslwIYaJh9vGIp7+v5x6wMo3xpCE7g7Rf8C9 KUEFWFMiNCRZyT0R5EIA5CfKfhc7O3pLy990CWhDla8LYTkFd+jvDT9VCqvxwfyTtwrS 5Ihw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=fhSptTEBrVI+GlmMSHhgsp3uZMybLem+Wlds/l5rEgw=; b=VyZeG1WTjCAw8nDWDQz8yMh9Wjvh80xz3v1He+QH2HiFhoE8mk8eYZoricVl+WRHz1 B9KhPKMyprxTl3wIYY12Z5RhijhHN6HgO2XNiJiHhy6HbeKhYr7YgG0CtHYKfbEz9uwh lAwtATMbD0ZE9e7Adsp1gFkdsS8ZzZWNOPC31i1vsteEKpQHR7a31imTs4GOEVJx7kgS t8cPfeHLHqx7asK3RKu0QkH2ZagkcqKCi4WATGpyZ2sjH+6FehwNYBJ71jNb0lk3/ID+ dgMBzLtmPrJO0M4gseVZrwNhxkTlNiVsL0FJGDiYip1tZZdQP98ul9+ab2HIOTG1T9uU IDrA== X-Gm-Message-State: APjAAAWd2xBgJdDdvV2jpmdlyzVMKoTBnuji82Efahl/0H73qr1UEz+O Gf8CbwRqjhNHMmZS2wNebXBRcJGznJU= X-Google-Smtp-Source: APXvYqx9LtuIJltMH/W/wCOUtsBrQK+5JAYSDDhQoFBKRsREy/VLhEIa4rmSxFDpJKk5b54O1/GCSQ== X-Received: by 2002:a5d:6246:: with SMTP id m6mr2164616wrv.262.1571304010783; Thu, 17 Oct 2019 02:20:10 -0700 (PDT) Received: from localhost.localdomain ([212.15.160.218]) by smtp.gmail.com with ESMTPSA id v7sm1518966wrr.4.2019.10.17.02.20.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 02:20:10 -0700 (PDT) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Oct 2019 11:20:01 +0200 Message-Id: <20191017092001.4566-1-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] avcodec/ac3enc_float: fix fdsp 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes #8294 Signed-off-by: Paul B Mahol --- libavcodec/ac3enc_float.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c index d6e658b2b4..18df313c1a 100644 --- a/libavcodec/ac3enc_float.c +++ b/libavcodec/ac3enc_float.c @@ -132,10 +132,16 @@ av_cold int ff_ac3_float_mdct_init(AC3EncodeContext *s) av_cold int ff_ac3_float_encode_init(AVCodecContext *avctx) { AC3EncodeContext *s = avctx->priv_data; + int ret = ff_ac3_encode_init(avctx); + + if (ret < 0) + return ret; s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); - if (!s->fdsp) + if (!s->fdsp) { + ff_ac3_encode_close(avctx); return AVERROR(ENOMEM); - return ff_ac3_encode_init(avctx); + } + return 0; } AVCodec ff_ac3_encoder = {