From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3C453A0C41; Wed, 17 Nov 2021 18:14:07 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8C274068C; Wed, 17 Nov 2021 18:14:06 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2058.outbound.protection.outlook.com [40.107.212.58]) by mails.dpdk.org (Postfix) with ESMTP id E177D40687 for ; Wed, 17 Nov 2021 18:14:04 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FPiz6eGw721vXJY3hJZr/pz8syCHOL+hLLhYVx7PuG8ZUYLPr+Xr2HeLHJN+GY3fRNX8wvCNKdzYC1vbX+/eKoqRW+Xl++r7ufC7uqN26QpVUB7jEnetOqIv7FkX5Sq0Rb/3kFpKvD2cBG5gV5ck4PTZBPZFzdwx4UHS4Tltk8/sI2LE9z4ASP69wcPkQPoAVnFLN0KRYKmRoAqBgnKpzaYJYXvwO7RzjA+XamoTBHOxDrHsZ3nkcM9d68KtBdLkSlfWj0AC8GSDroItfJjoiZLD+Ze2hvJQlXteqvYngZRTWxPGQJ1bkojQNZrEj+RNYbDygb/36YSSMUSj0y18vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EWIfFaSTwIV12ZbIW9fOejfkWc+7v0mJr/piRq73+kk=; b=N6P69ddmTO+ScdeFs+wbg/X/MHeGeJZKVvXE0+NT0crUP09FXrZ/23OOle4SpwAr43M6i4/BjXu5FWiPdAHTFYTwkE4w+FuGJ+HmYdbk7BjZQQgzM9l+RneNoruxj0M8ypA5N+7/c6CuS+Ir3DKD6GRo1WSuAzAMFhpYODOeix5JxNIFejuruRTFeE885V33XHRh9PKfCOCtqBt21NeZHLC3sCimdDgRXVI3OrRXZZtHyLv/3OS1r8FmjZNO5Lg9HNLTdFb0Dw2Rl1X/z+dyOV0zALF3s9LXGBU0KiFkV6kYopJIh4lexbPyRC9awhneMIQ1w6blWw1Xr9nlFxM/xA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EWIfFaSTwIV12ZbIW9fOejfkWc+7v0mJr/piRq73+kk=; b=FMH9aYYsERfYPfyfr3EX1TlAHrV56+DOThVbyPR1/EM45ydVxyk/inR+8wSUr7q2RvIIzncBzrHdmIl0XCDzLxqqlzn+K6/KzRFbYq5zoSUo+Zxh3B+IwEJm3sCULaADbxCYbhyxcho8Eci90JtiOLuAk7AZk1QJF1G2fUK8qHZmUvyCoZO5HfwooU8/pdWJYdlgVOaTXTGvjXbrZgtfXRnK3dKWjNXAE5MAuyblNKS4DZMv2lDAY4fBjnn6wexnZnL/GDc6+KUZJS/6wnHJ3gQg2jz+i7w+diRHCfhYlD771AvPSz6Zc8Ay2scPzOdGbuqXqgK1kC2SScGzAskEGQ== Received: from DM6PR08CA0037.namprd08.prod.outlook.com (2603:10b6:5:1e0::11) by CH2PR12MB3733.namprd12.prod.outlook.com (2603:10b6:610:15::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 17:14:02 +0000 Received: from DM6NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1e0:cafe::91) by DM6PR08CA0037.outlook.office365.com (2603:10b6:5:1e0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Wed, 17 Nov 2021 17:14:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT026.mail.protection.outlook.com (10.13.172.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Wed, 17 Nov 2021 17:14:02 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 17 Nov 2021 17:13:17 +0000 From: To: CC: Elena Agostini Subject: [PATCH v2] app/test-gpudev: remove memory leaks in case of errors Date: Thu, 18 Nov 2021 01:23:51 +0000 Message-ID: <20211118012351.9458-1-eagostini@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211117204453.27337-1-eagostini@nvidia.com> References: <20211117204453.27337-1-eagostini@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 987de310-ddac-4654-c0ee-08d9a9eda6de X-MS-TrafficTypeDiagnostic: CH2PR12MB3733: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:22; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rf1myQkpPh1yzs8CRyyOFa7MkYdu/RSWlIchVxnGMq8JBM0VXekkzB3ak5yFKHzXoODuAqILJT33+7Gxi0c6VmIbGodYLmwsnxToYfdDLXHOXslOVKROU3MuJPLzTSjP01e5KJ5znxEIjmndBaW1rfKCoI2Z9SOwcJXRZJ7bwbQ0Fu1xHed+qtIuiQJXfk9dAcmtcgQsBIsdOGzJAWGHZNEshqHKHiK27bmz2cPskdB498zUjd7gS2fsfADlhexiarJfpnXDBdfcN120r4YsC36Zik4MYJw+BfM1kX430zWovZU+Dj6+6EbdNZX400gE4OFjeWML3AyQtHF7s9bQKi05SzQ1TBucJrhOo82u3EtRKjNG3uoDgHm8MPqDVKFS5bn6R9sbQubAilFSVw+oxWxnek1uPvJ4uwaZ7tT/wtpOIjE/wAeYHxRLUmTQ4uP/3YpzTt/i9WgxF1+5Gbb26W42cVY2Va4oeJ71d06D9nV98P96P90mlmUb0sfSzty8GPBqBasidLGwcuv9+y5V17AkqNwcYZVgz9rpRP23Zg0+Dy01/ZpKGk0IFIKxa5Wryh/ZzUzHBc0z85k6x4R4S11rjewXV6yGEIiA84T3YDTW2YhifSRw9YJj8YGCus40toXyIwRy+w84XFZPf8sN3RBxKD2CU8mNSVLoCuTeR1+jO7bLpvEVpegIMbpMiIk25cymQMwAqFMC7wQ4XIscfg== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(86362001)(82310400003)(2906002)(6666004)(83380400001)(6916009)(26005)(316002)(4326008)(107886003)(6286002)(70586007)(70206006)(426003)(336012)(186003)(2616005)(7696005)(1076003)(36860700001)(2876002)(55016002)(508600001)(16526019)(5660300002)(8676002)(36756003)(47076005)(356005)(7636003)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 17:14:02.0316 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 987de310-ddac-4654-c0ee-08d9a9eda6de X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3733 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Elena Agostini Signed-off-by: Elena Agostini --- app/test-gpudev/main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/test-gpudev/main.c b/app/test-gpudev/main.c index c647e30de4..250fba6427 100644 --- a/app/test-gpudev/main.c +++ b/app/test-gpudev/main.c @@ -117,6 +117,10 @@ alloc_gpu_memory(uint16_t gpu_id) return 0; error: + + rte_gpu_mem_free(gpu_id, ptr_1); + rte_gpu_mem_free(gpu_id, ptr_2); + printf("\n=======> TEST: FAILED\n"); return -1; } @@ -165,6 +169,9 @@ register_cpu_memory(uint16_t gpu_id) return 0; error: + + rte_gpu_mem_unregister(gpu_id, ptr); + rte_free(ptr); printf("\n=======> TEST: FAILED\n"); return -1; } @@ -227,6 +234,8 @@ create_update_comm_flag(uint16_t gpu_id) return 0; error: + + rte_gpu_comm_destroy_flag(&devflag); printf("\n=======> TEST: FAILED\n"); return -1; } @@ -254,7 +263,7 @@ create_update_comm_list(uint16_t gpu_id) { int ret = 0; int i = 0; - struct rte_gpu_comm_list *comm_list; + struct rte_gpu_comm_list *comm_list = NULL; uint32_t num_comm_items = 1024; struct rte_mbuf *mbufs[10]; @@ -327,6 +336,8 @@ create_update_comm_list(uint16_t gpu_id) return 0; error: + + rte_gpu_comm_destroy_list(comm_list, num_comm_items); printf("\n=======> TEST: FAILED\n"); return -1; } -- 2.17.1