From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id E745CA04B1;
	Mon,  5 Oct 2020 18:16:46 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 9BD1E1B774;
	Mon,  5 Oct 2020 18:16:44 +0200 (CEST)
Received: from mail-io1-f65.google.com (mail-io1-f65.google.com
 [209.85.166.65]) by dpdk.org (Postfix) with ESMTP id E9C211B677;
 Mon,  5 Oct 2020 18:16:41 +0200 (CEST)
Received: by mail-io1-f65.google.com with SMTP id v8so9763858iom.6;
 Mon, 05 Oct 2020 09:16:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=nxxadVeQ/2GqYtWHI1z/k/OLxIsPPb124N2mwTLeRjA=;
 b=PkOicsSt4U+yk48rCea2xeEfb+DjZJIDDtfIzEdV6B33z1PwS+joVX+WxgfCEgWNjq
 7iBGP3DhFO0CCYz+QWtCZfzJ+aMpQaITDDdd32E8jNNyyIjXUUdB4vWtia18dH46z7dH
 TE5UIz8webp2yoX0j7dePx4nA6RTYwtg9McTVbXqSRotndeBuzotnG1G+pEjOA7AND1z
 aIgZCiXOFLSs6aOQTYs0zO+fHkDEox7benpP8pEEQjUQrqJ1LNOQOhV1Xwqyg7pVrWNU
 oiqL5OxHgigHu+ytGtqCrNQj774afV3s42dS3cBP9bBme+5KUuwFPnl0At46hlZ7AcLP
 GyNw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=nxxadVeQ/2GqYtWHI1z/k/OLxIsPPb124N2mwTLeRjA=;
 b=CXNM9z0/nbzXVfAGrPFqNU2DgkHT+IJnglsP9hWrX66szkTs68FvwrxLrab+oHE3y2
 QbpbaLIuQuN1PpcO7/sOqJ4asveG4kTG2oH6MmIGKwpPwo0RWSWqUEyIVlyRS20i//j8
 jJeYmgxc+kbUmQSuKcTnnpzM84QO7pom4jOH2gw9uJeuOLMCSYXsSd4n2kbwby1PzSOj
 Wj3UvGeolchiFSQdhIBYa5sn6I1PqgecrW7ghh8YUmsGvmO1SQW4b7oShhG8ZeLxfR/u
 HKuLVOE12Z9Y/F7d3l39PCWDCtqDYIZawpaW5eqOAvBzsZlCu6kEgYAcrLQaxxlZw5FW
 x2gg==
X-Gm-Message-State: AOAM531lR0+FHFx4f+4QvavTj382h3ouUMegE4zKfEqIjTEfhMCa1PIW
 TYjWoJzJTiyevw8J9K3HWiaBp2SfWihiZ7HOFM8=
X-Google-Smtp-Source: ABdhPJwqD0FH/GXAPWtpgjbl2a8G7gl4SyJdnc660eAF3PEERGYFt0MW8bWmLmKT5rm4sF1t/lxGrTV6xoKHaXJmXaU=
X-Received: by 2002:a05:6638:16c5:: with SMTP id
 g5mr692088jat.112.1601914600285; 
 Mon, 05 Oct 2020 09:16:40 -0700 (PDT)
MIME-Version: 1.0
References: <b511454f0252d3c0d18e15ec587312ba7400fdb6.1601368991.git.wangyunjian@huawei.com>
In-Reply-To: <b511454f0252d3c0d18e15ec587312ba7400fdb6.1601368991.git.wangyunjian@huawei.com>
From: Jerin Jacob <jerinjacobk@gmail.com>
Date: Mon, 5 Oct 2020 21:46:24 +0530
Message-ID: <CALBAE1PKBAj9TkotYgOd+RmeJ+NOsHUYfxZnTyN9PwPBRADtNQ@mail.gmail.com>
To: wangyunjian <wangyunjian@huawei.com>
Cc: dpdk-dev <dev@dpdk.org>, Jerin Jacob <jerinj@marvell.com>, 
 "Lilijun (Jerry)" <jerry.lilijun@huawei.com>, xudingke <xudingke@huawei.com>, 
 dpdk stable <stable@dpdk.org>
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH] eventdev: fix adapter leak in error path
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Tue, Sep 29, 2020 at 7:17 PM wangyunjian <wangyunjian@huawei.com> wrote:
>
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> In rte_event_crypto_adapter_create_ext() allocated memory for
> adapter, we should free it when error happens, otherwise it
> will lead to memory leak.
>
> Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied to dpdk-next-eventdev/for-main. Thanks.

> ---
>  lib/librte_eventdev/rte_event_crypto_adapter.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/librte_eventdev/rte_event_crypto_adapter.c b/lib/librte_eventdev/rte_event_crypto_adapter.c
> index 8f2593316..b04312128 100644
> --- a/lib/librte_eventdev/rte_event_crypto_adapter.c
> +++ b/lib/librte_eventdev/rte_event_crypto_adapter.c
> @@ -241,6 +241,7 @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id,
>         if (ret < 0) {
>                 RTE_EDEV_LOG_ERR("Failed to get info for eventdev %d: %s!",
>                                  dev_id, dev_info.driver_name);
> +               rte_free(adapter);
>                 return ret;
>         }
>
> --
> 2.23.0
>