From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50041.outbound.protection.outlook.com [40.107.5.41]) by dpdk.org (Postfix) with ESMTP id C0AA04C9F for ; Wed, 24 Oct 2018 07:33:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9nOhPzXPa8AlpcKBfWMrynaUlTQjq+ELpl9A7lGTQCE=; b=kjTLy9MrB41kAQd1Pdj5kJwI5Toy94xXvjt25cslsyY0Eu/fO8zDmRmMfOHRIfe9mbF2IMB3I3r2os54dy+PGbUJTG3iTncc9VqAlDzz7UWdYLEF7eRNpclBbRPKgPR5jaDOoAZPGW1PLEDSeb3/75qKzRT9n1UQ8XGm2mwIjnI= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB3085.eurprd04.prod.outlook.com (10.170.228.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Wed, 24 Oct 2018 05:33:41 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::88ff:b776:3f9c:5bb2]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::88ff:b776:3f9c:5bb2%2]) with mapi id 15.20.1250.028; Wed, 24 Oct 2018 05:33:41 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "thomas@monjalon.net" , Shreyansh Jain Thread-Topic: [PATCH] raw/skeleton_rawdev: fix memory leak on test failure Thread-Index: AQHUa1sfp+b1VixV+0+kgiIjUwZ6pQ== Date: Wed, 24 Oct 2018 05:33:41 +0000 Message-ID: <20181024053302.22937-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.142.187.166] x-mailer: git-send-email 2.17.1 x-clientproxiedby: BM1PR0101CA0025.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::11) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB3085; 6:CxTt9K4myKl/2NqqzcmF+sEo4GR3JDlitaGMtW0aQoTO4zQp8ctXFm+2kOI2y8rJ8gsGCfRGwxPStcbRBZ5qfsE2ozUa2J4hDBGGzV0U7v7PVc0uor7R/3TWxxIss+O0QdMyb585U8zkLiIZgQ6Ueczyz9ePGfa5CPiaKtGVHy4p00AnvtHSg7VCYux5e4gH3svHX5PPRBtpt0uhyYPYClTBatWEd76LBCOeW79yFUc1++fRtgYJmaZ4nTwG5ItvjF7T9RbUWUimsE5GznRtENecwrZ8Kzi1g69vplm7sH2uFt65SIu5o9DjqKwvR+VF1Cn66blqE/UKsEoEPekZM4VVAV4LVJDwczGOpKUAGQKjvBAaYDaVQk29E2JN2L2xnK9mb3IwZGh+q7ZUe0PY19nrnxQeRdwSkbEIg8fhpOLoMeFtqyCiCa+WlBJSgT5B9VHclMtIHLVnLwenzyvAZw==; 5:KR2ooKLf5C33vkhqHiivb1r7zxB53WxAczMC+JmMHCRzEUIuF0qpPVVjNEINuVnlunjDL+BU0YyYe00zU2zJo6Jh+eDEFSyNovADE6GEEsw5Bc4wvrQQsohQUDOkwVR0f6vu0p4y3Bp6z98QdfHx0wss4hBv5SzchQI2CBrwPoc=; 7:eT/bhCexNJwKvRVgkdH5Qe/M+KePirjJj2rX1vGbvho3W1Bd7TwJwUzSA3oev1as8KgIdRjx8i48wgNr1iCrhyCwt3x6cm7cG+/HBYreQFnKisokip8BWf/fGq1cmkuyYFm9ctSqISrVGwn5OltF2f3VWO6Jbigh9/Va3mOB6aMXePDhDViXz5XA4pDlIPSghJZvz42owdCCTtjOYWnveMG3hV0q1T1Pz8kDjBkr2Mz3Wr96lI8EHuS7dT7MzYlp x-ms-office365-filtering-correlation-id: c9e60b4e-200e-4f92-6302-08d639724156 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB3085; x-ms-traffictypediagnostic: VI1PR04MB3085: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:VI1PR04MB3085; BCL:0; PCL:0; RULEID:; SRVR:VI1PR04MB3085; x-forefront-prvs: 083526BF8A x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(346002)(376002)(39860400002)(366004)(396003)(189003)(199004)(256004)(14444005)(68736007)(8936002)(86362001)(55236004)(575784001)(5640700003)(1857600001)(105586002)(66066001)(106356001)(386003)(6506007)(6436002)(14454004)(478600001)(6486002)(316002)(26005)(5250100002)(8676002)(81156014)(2501003)(186003)(81166006)(1730700003)(7736002)(53936002)(102836004)(305945005)(6512007)(2351001)(4326008)(97736004)(25786009)(1076002)(36756003)(3846002)(50226002)(6116002)(78486010)(6916009)(2616005)(486006)(52116002)(2900100001)(99286004)(54906003)(476003)(71190400001)(5660300001)(71200400001)(2906002)(44832011); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB3085; H:VI1PR04MB4688.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: SXofS5BH1sZu7vsAN88J3Fp50Cb0z0tZIFHh9ZKbZOTPf8ILQYpFuW/8K89om3C8fPkjyfDZt+Eldk7PYZ7vUhBIiY6rgCZZxf6Ylr5P1VLND5yPiu3RvpzAnhL0O0cVQNQAG8NA+9Y1yBJbSa7ocnUaaM572WHPUGRxYX9OMdNv78lSdjzu94uQDaZn3o/4RsgGFxssKQBjfZeco+OVs8Orbu3zQOXag4HmZU3/TFBoOJURMdZE6JHz4i3J852EFldWD0Qhta9+mPAkPylePg3SCvLMDLzXsA7sxByEhaZbYTqmdmG+pe35eIZaBz7ESWRwTU2FtxlfBO6q/6MmjQ25ycMjFLVeG8gTD/TmoKk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9e60b4e-200e-4f92-6302-08d639724156 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Oct 2018 05:33:41.1145 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3085 Subject: [dpdk-dev] [PATCH] raw/skeleton_rawdev: fix memory leak on test failure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2018 05:33:43 -0000 In skeleton_rawdev unit tests, a malloc'd memory was leaking in case the next sequential test fails. This fix moves the free of the malloc'd memory above the failing test. Coverity issue: 260402 Fixes: 55ca1b0f2151 ("raw/skeleton: add test cases") Cc: shreyansh.jain@nxp.com Signed-off-by: Shreyansh Jain --- drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c b/drivers/r= aw/skeleton_rawdev/skeleton_rawdev_test.c index 3405b8984..359c9e296 100644 --- a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c +++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c @@ -294,13 +294,14 @@ test_rawdev_attr_set_get(void) "Attribute (Test1) not set correctly (%" PRIu64 ")", ret_value); =20 + free(dummy_value); + ret_value =3D 0; ret =3D rte_rawdev_get_attr(TEST_DEV_ID, "Test2", &ret_value); RTE_TEST_ASSERT_EQUAL(*((int *)(uintptr_t)ret_value), 200, "Attribute (Test2) not set correctly (%" PRIu64 ")", ret_value); =20 - free(dummy_value); return TEST_SUCCESS; } =20 --=20 2.17.1