eventdev: fix adapter leak in error path
authorYunjian Wang <wangyunjian@huawei.com>
Tue, 29 Sep 2020 13:46:33 +0000 (21:46 +0800)
committerJerin Jacob <jerinj@marvell.com>
Thu, 15 Oct 2020 19:38:09 +0000 (21:38 +0200)
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>
lib/librte_eventdev/rte_event_crypto_adapter.c

index 8f25933..b043121 100644 (file)
@@ -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;
        }