get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/108048/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 108048,
    "url": "https://patches.dpdk.org/api/patches/108048/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/tencent_D84ED137D548814867CC048FD7E94504BA06@qq.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<tencent_D84ED137D548814867CC048FD7E94504BA06@qq.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/tencent_D84ED137D548814867CC048FD7E94504BA06@qq.com",
    "date": "2022-02-22T18:18:16",
    "name": "[18/20] raw/ifpga/base: fix memory leaks in error handlings",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "546bc648f0789251711e382ceb92d47f69ac7fce",
    "submitter": {
        "id": 2458,
        "url": "https://patches.dpdk.org/api/people/2458/?format=api",
        "name": "Weiguo Li",
        "email": "liwg06@foxmail.com"
    },
    "delegate": {
        "id": 24651,
        "url": "https://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/tencent_D84ED137D548814867CC048FD7E94504BA06@qq.com/mbox/",
    "series": [
        {
            "id": 21799,
            "url": "https://patches.dpdk.org/api/series/21799/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=21799",
            "date": "2022-02-22T18:17:58",
            "name": "fix memory leaks in error handling",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/21799/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/108048/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/108048/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 614C9A034E;\n\tTue, 22 Feb 2022 19:20:29 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0AECC4115C;\n\tTue, 22 Feb 2022 19:19:37 +0100 (CET)",
            "from out203-205-251-80.mail.qq.com (out203-205-251-80.mail.qq.com\n [203.205.251.80])\n by mails.dpdk.org (Postfix) with ESMTP id 4BA0041145\n for <dev@dpdk.org>; Tue, 22 Feb 2022 19:19:35 +0100 (CET)",
            "from localhost.localdomain ([111.193.130.237])\n by newxmesmtplogicsvrszc6.qq.com (NewEsmtp) with SMTP\n id 49223207; Wed, 23 Feb 2022 02:18:18 +0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com;\n s=s201512; t=1645553973;\n bh=f2ZOSh9v76jD3jQbTwD7a8KMowCv5PaSk37CMESd6Zc=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References;\n b=Q1NGkN0Fin+3HKUFMQ4kVxwE92Iik/ehxP7v46vXJFPnzPGEAeKLC8BYvfpc2PBzs\n YI9Kl+GmgxjKB/TJVXHtlmmCwYpyNfOjsteeUgm8voNmkPUnQ0alSgLWrs8NP9FxAP\n scFtjC68OXPMPj8YFUqIrRjO/mAd/8h8H8PQAftA=",
        "X-QQ-mid": "xmsmtpt1645553968t3b8246ur",
        "Message-ID": "<tencent_D84ED137D548814867CC048FD7E94504BA06@qq.com>",
        "X-QQ-XMAILINFO": "M3ziZXKDk+iOWroA3Zcnq7vFOEjvsEbSmyT1svqABeGwVXMm+EkRWeFSKxG4Yw\n 6ZO2kRtR2FsRvRWIlJS6clf25tBITtoyzUituIApSmEMrfsaBMJFgpSWxHnKOvUVa59K/Wa8jFyN\n ZEBzjYz5T2M+w4mqRuvy5GMGIeaf/6TrZFpCXnBkzz28ikxNunsLbMIBItctFjM0Ljf/l+cLA0MT\n 9qm3CnDnei2t/flqah7Pwtir4eS2tpKHfaxSuKYBoszXjZiELAISbeFhrZ4BjpT1vqCmrBJYBBo6\n dguzCeHr85nWDPMEVBDyyhFYDYHqhBwq3GirTt5ZK9Sbm0l6BUm4JExvR1QVzJO/Nxj5+Wh/u1Tc\n AkmIC14w9dd2OF7OUPJie34vQd5sZcyj2NSMoaeVnq+vCNMxbvh5TM+EFmbluzcvp7SHVGbEOYmf\n EMI1tgHfdZ8x5NVBCDn9YRPvsES5gWR57bmdkOEOUTAuGVGnaqodIW7ikYl9ERmUlk2/rA6Re6yR\n Ucvb17chQ/et/W2YNAaI11g/OyjMFp2Sfhrg3I9KBBmXJwPQNnAswcIRFgi2pb8PmHNgUYCdPs2e\n 4Ujf/DtiJDm4q7VsvnNfQryG8kPnG/KEo2ZsEownXgPjpojzJZYe9WME2x4Rqw32yZiasEbwy9uh\n Y23O2FBWWxeuZoQeE99o5vd0QSjPDmZo10eMjys6sb2MneQL4xPr8Zq2wF7TTmIkg63tYixiiZ9/\n zxHJ21zGXj7BdFweM1TumLAVWb7pgLsq5RedFKU3RO/dlxqlpSePaGYqNwWJXPL7utzW3uwE0Nc3\n UhTt1sKkIfEDWAdqJnA3GiOqwrvluInkGPr9+kvgfr4WsSaQsZJfr0TVGmzqih0umB8nPsJYnh4W\n x8HHRyNUwZfCyqoHDnJjGlnjnUOrsxTw==",
        "From": "Weiguo Li <liwg06@foxmail.com>",
        "To": "dev@dpdk.org",
        "Cc": "adypodoman@gmail.com, xiaoyun.li@intel.com, tianfei.zhang@intel.com,\n bruce.richardson@intel.com, ivan.malov@oktetlabs.ru, jgrajcia@cisco.com,\n hkalra@marvell.com, ying.a.wang@intel.com, ting.xu@intel.com,\n simei.su@intel.com, qiming.yang@intel.com, motih@mellanox.com,\n shreyansh.jain@nxp.com, skoteshwar@marvell.com, stephen@networkplumber.org,\n kalesh-anakkur.purayil@broadcom.com, somnath.kotur@broadcom.com,\n declan.doherty@intel.com, gakhil@marvell.com, nicolas.chautru@intel.com",
        "Subject": "[PATCH 18/20] raw/ifpga/base: fix memory leaks in error handlings",
        "Date": "Wed, 23 Feb 2022 02:18:16 +0800",
        "X-OQ-MSGID": "\n <770f3c34fdb4a473d509a1f45668af068227f5fa.1645551559.git.liwg06@foxmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<cover.1645551559.git.liwg06@foxmail.com>",
        "References": "<cover.1645551559.git.liwg06@foxmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "1) in ifpga_enumerate.c:\nThe memory 'feature' is stored by TAILQ_INSERT_TAIL() at the end of the\nfunction. When function returned early in error handling, 'feature' is\nnot released and leads to a memory leak.\n\n2) in opae_eth_group.c and opae_i2c.c\nThese function return 'dev' when success and return NULL when validation\nfailed or some error occur. In the latter case 'dev' is not released and\nleads to a memory leak.\n\nFixes: 56bb54ea1bdf (\"raw/ifpga/base: add Intel FPGA OPAE share code\")\nFixes: 12f92a513a13 (\"raw/ifpga/base: fix retimer link status\")\nFixes: 15d21c851028 (\"raw/ifpga/base: add I2C and at24 EEPROM driver\")\n\nSigned-off-by: Weiguo Li <liwg06@foxmail.com>\n---\n drivers/raw/ifpga/base/ifpga_enumerate.c | 10 ++++++++--\n drivers/raw/ifpga/base/opae_eth_group.c  |  1 +\n drivers/raw/ifpga/base/opae_i2c.c        |  5 ++++-\n 3 files changed, 13 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/raw/ifpga/base/ifpga_enumerate.c b/drivers/raw/ifpga/base/ifpga_enumerate.c\nindex 48b8af4587..ae7bc9326d 100644\n--- a/drivers/raw/ifpga/base/ifpga_enumerate.c\n+++ b/drivers/raw/ifpga/base/ifpga_enumerate.c\n@@ -100,12 +100,16 @@ build_info_add_sub_feature(struct build_feature_devs_info *binfo,\n \t\t\t(unsigned long long)feature->phys_addr, size);\n \n \tif (vec_cnt) {\n-\t\tif (vec_start + vec_cnt <= vec_start)\n+\t\tif (vec_start + vec_cnt <= vec_start) {\n+\t\t\topae_free(feature);\n \t\t\treturn -EINVAL;\n+\t\t}\n \n \t\tctx = zmalloc(sizeof(*ctx) * vec_cnt);\n-\t\tif (!ctx)\n+\t\tif (!ctx) {\n+\t\t\topae_free(feature);\n \t\t\treturn -ENOMEM;\n+\t\t}\n \n \t\tfor (i = 0; i < vec_cnt; i++) {\n \t\t\tctx[i].eventfd = -1;\n@@ -130,6 +134,8 @@ build_info_add_sub_feature(struct build_feature_devs_info *binfo,\n \t\tTAILQ_INSERT_TAIL(&hw->port[port_id].feature_list,\n \t\t\t\tfeature, next);\n \t} else {\n+\t\topae_free(feature->ctx);\n+\t\topae_free(feature);\n \t\treturn -EFAULT;\n \t}\n \treturn ret;\ndiff --git a/drivers/raw/ifpga/base/opae_eth_group.c b/drivers/raw/ifpga/base/opae_eth_group.c\nindex be28954e05..cd9b2443c7 100644\n--- a/drivers/raw/ifpga/base/opae_eth_group.c\n+++ b/drivers/raw/ifpga/base/opae_eth_group.c\n@@ -297,6 +297,7 @@ struct eth_group_device *eth_group_probe(void *base)\n \n \tif (eth_group_hw_init(dev)) {\n \t\tdev_err(dev, \"eth group hw init fail\\n\");\n+\t\topae_free(dev);\n \t\treturn NULL;\n \t}\n \ndiff --git a/drivers/raw/ifpga/base/opae_i2c.c b/drivers/raw/ifpga/base/opae_i2c.c\nindex 598eab5742..0a9abff14d 100644\n--- a/drivers/raw/ifpga/base/opae_i2c.c\n+++ b/drivers/raw/ifpga/base/opae_i2c.c\n@@ -479,6 +479,7 @@ struct altera_i2c_dev *altera_i2c_probe(void *base)\n \n \tif (dev->i2c_param.devid != 0xEE011) {\n \t\tdev_err(dev, \"find a invalid i2c master\\n\");\n+\t\topae_free(dev);\n \t\treturn NULL;\n \t}\n \n@@ -494,8 +495,10 @@ struct altera_i2c_dev *altera_i2c_probe(void *base)\n \tdev->i2c_clk = dev->i2c_param.ref_clk * 1000000;\n \tdev->xfer = altera_i2c_xfer;\n \n-\tif (pthread_mutex_init(&dev->lock, NULL))\n+\tif (pthread_mutex_init(&dev->lock, NULL)) {\n+\t\topae_free(dev);\n \t\treturn NULL;\n+\t}\n \tdev->mutex = &dev->lock;\n \n \taltera_i2c_hardware_init(dev);\n",
    "prefixes": [
        "18/20"
    ]
}