From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67A80A052B; Fri, 31 Jul 2020 06:54:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6A56E2862; Fri, 31 Jul 2020 06:54:38 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80080.outbound.protection.outlook.com [40.107.8.80]) by dpdk.org (Postfix) with ESMTP id A63FA2629 for ; Fri, 31 Jul 2020 06:54:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yNXywC9djK2srGQV4H9JDK09dpIAzppc1Z0BbYwrfdo=; b=zSxgtcMAefld3lXsMcYkGhBI/B+mjyyvXJJnfEyfRXWDXLzFRNNp8cCyWt2ITgQ9Iua0NlrNkO8Dz9ipPjzinvZiCtPOrs0ddLzxLdF9Lhs49Vc5lvC1fYkoAe8rmR2EOdB/MC6Cz5aQ6XC2hBNNixGamj0iBBd/7U+DWQnM+RI= Received: from AM7PR04CA0026.eurprd04.prod.outlook.com (2603:10a6:20b:110::36) by DB8PR08MB5017.eurprd08.prod.outlook.com (2603:10a6:10:ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16; Fri, 31 Jul 2020 04:54:35 +0000 Received: from AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::8f) by AM7PR04CA0026.outlook.office365.com (2603:10a6:20b:110::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17 via Frontend Transport; Fri, 31 Jul 2020 04:54:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT054.mail.protection.outlook.com (10.152.16.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17 via Frontend Transport; Fri, 31 Jul 2020 04:54:35 +0000 Received: ("Tessian outbound 1c27ecaec3d6:v62"); Fri, 31 Jul 2020 04:54:35 +0000 X-CR-MTA-TID: 64aa7808 Received: from d0db5c36b71f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 86962DAF-8B34-4C21-8FB4-4E0857F68F07.1; Fri, 31 Jul 2020 04:54:29 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d0db5c36b71f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 31 Jul 2020 04:54:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A+cnNmaN1fCH8gDOcma8b/ippJD1OoRwzpAehG5MqfZ7a+4Gev8xeeP4stQqFzf+tSeQwqZFYChBYZcjqhjuOllRV1Q5+7MWy1D+QdX4XQsy9Tb0WealYD9uHMtTtavW2ryYywqSjwpVTznj0oSUW601Pn42Y2DN9G7i+c2moS/ZjRwNdAkH+ZdErt6xEMABKOkjyjkbJ8aZfKIiH8v7cQTRxkKWchzHHMGn61E3t9zioMdZhWaBUptupqTdBXWI/vBwiHVCANsJRci4AqvSwpICV08pcYQHAhj4E1KHJFngiTrkiuW8jxHv1kHI1pq5cV5XwYyK5/mPTrkEzO7ThQ== 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-SenderADCheck; bh=yNXywC9djK2srGQV4H9JDK09dpIAzppc1Z0BbYwrfdo=; b=hsK4E51fkcOvvnt1gJRrSTgamsGH6aVGYOkU0NBvmEtNPjdOueCbK08Wv139yQ2eDM8beLHWWdertbsjJZ7D+ueBKRoOdAq47xzIeY/LHIq64xHQfkXfH1DwOGMvGXf37bvygm7kZEimpMSRL6BJWHzpxxFRhNccc/43st//o1PljtopnqHdjJSc9lyylkrzECDxvMZJ4414m2fm5hJkDQZwuqY4mtO6mC19zUtZnjw6ddHoIw/RJJwuEgEpUjRAuxO1xwlxsuZ1luReePN5SrE597TOqcku4KvpYQc6j8Ad9f/doJMwmrtyi317XLr7vvhTuA81FD9Ds6qgPj9J8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yNXywC9djK2srGQV4H9JDK09dpIAzppc1Z0BbYwrfdo=; b=zSxgtcMAefld3lXsMcYkGhBI/B+mjyyvXJJnfEyfRXWDXLzFRNNp8cCyWt2ITgQ9Iua0NlrNkO8Dz9ipPjzinvZiCtPOrs0ddLzxLdF9Lhs49Vc5lvC1fYkoAe8rmR2EOdB/MC6Cz5aQ6XC2hBNNixGamj0iBBd/7U+DWQnM+RI= Received: from DB6PR0802MB2216.eurprd08.prod.outlook.com (2603:10a6:4:85::9) by DB6PR0801MB1830.eurprd08.prod.outlook.com (2603:10a6:4:35::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.18; Fri, 31 Jul 2020 04:54:27 +0000 Received: from DB6PR0802MB2216.eurprd08.prod.outlook.com ([fe80::9d1d:207b:e89d:199d]) by DB6PR0802MB2216.eurprd08.prod.outlook.com ([fe80::9d1d:207b:e89d:199d%10]) with mapi id 15.20.3216.034; Fri, 31 Jul 2020 04:54:26 +0000 From: Honnappa Nagarahalli To: Gaurav Singh , "dev@dpdk.org" CC: nd , Honnappa Nagarahalli , nd Thread-Topic: [dpdk-dev] [PATCH] librte_metrics: fix memory leak Thread-Index: AQHWZu0gV/Fv/mbli0auUmXgpnzk0akhHiHg Date: Fri, 31 Jul 2020 04:54:26 +0000 Message-ID: References: <20200731034520.30791-1-gaurav1086@gmail.com> In-Reply-To: <20200731034520.30791-1-gaurav1086@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 985ff7bf-9280-4e66-969d-8e9d45338307.0 x-checkrecipientchecked: true Authentication-Results-Original: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [70.112.90.121] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ea9820e9-22d6-42f8-b5cc-08d8350dd275 x-ms-traffictypediagnostic: DB6PR0801MB1830:|DB8PR08MB5017: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:3513;OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 1GF1NP9WI5dmFzz09Rv+pbJQtt199BW9IZGU//k5Z08WOcj+F/Iks2YsK0exgDfnIGbpzAau4spirdCBPNGHax4QJuMcnsSni36dCjmA2spY0DtATsJ0FGufQCu2QfhTldM7loHkoeGGpRg6pN7D6S2m47xZ+YcoH1xg/wv4aECkMhsK22Io33DVRED0sPIM1B9+JE8wmx5qalR/DjnANE3ACFyMc7nwIOTHpcnssNkEgpOQ5ubkoXmbuVUn4gJK54hK5TdK64TgG2DEByTwGYl7IoX5dPOvhu5ZhSOjDUWOmlpo+qYC6I4k2PJQgQLU8yNxN6rumjS1sDO6qgBo0A== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0802MB2216.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(366004)(39860400002)(346002)(376002)(136003)(110136005)(71200400001)(33656002)(4326008)(316002)(54906003)(26005)(2906002)(7696005)(186003)(6506007)(66946007)(76116006)(52536014)(66476007)(64756008)(66446008)(66556008)(86362001)(5660300002)(478600001)(8676002)(83380400001)(55016002)(8936002)(9686003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: GJA2QBqjh0EBd+vGenKyp3b5NoNr6iYtLb6+b9orkBf3+rqYbTQMo1S7G79iTLqS3V3t3YsfxYfs7EdZ73DD/MC/gMAYn+HDOtyeSw6UKhQLrRl6fOEsGsdebj0DnQSbluNgciiFXO+8t5POn5XE3wSOGqbkg7Y35pGUUhh6FJ/2JvA1cBrf/xQWuBkacOUst1BKGfrtb99KG2JhdN55SzkQWGJdYCRfWj3MNc5nYA85Hb+zTyxs8FvQR0w1obbi03OS0dY8acXgjU3Xb6a53GnayhziGp6meRKFPEe6myjExYtGSAYop2BIJhC28m4eeDEOm6wsxZYafTOZtzoZ6nE6ouXU0HVuyua91Y3SXNgrTvzRRuLdB/jMQK1cMgsBg8dot9oxhaGLsDCL5zBs4X5I9tiuBlYKVtVl2NhGkHIz4aDEKLi3XpBpiYeCLQD26pvLGM4k17+hVU3SWyB9NNebjQSULixNyImtpRyLW8JVe6/aTvA6NGuXfQdlYQdo0pzwIxsqqnStoiVsvPwt0mWPoDdIeg9n3oX9SxBiq0beLYc4c67+ATfIgcdxYiK6qCkxYmIhBwsXnU0AeDvHbqA7FV+h8thYozENVw74enhDro6qcFVgBQsr5YPHY7s6U4xP+HObcq/oULGAxb3Yqw== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1830 Original-Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: accdd659-8f7e-47af-5656-08d8350dcd54 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E3VIs4lj1AuqFsc3Bhaq3nBbWEPlty5kSkI+k8P/ZPSvf4qZwtjl/ZskCajhF88g9X7T9VsY+DfLeLc0hD4XEuJSlONJlFWCWlaTcdsFUxYR0HOjUxAJ0jhznU5CGYNvZsjWvdDFh2xyTkHY0ATp6dx7lG6xZrhyYyLULu7yxQHTQBGFHwACqC8p+0jBfpRiY8+h041g7GE/BZlCxUUaxBK2/cfYxFl+lacsL6Vc+F4YHvKtanc8ZRuEY9kYierLYsEwrJ3MR1K03FIf1Q5GEUN39oWhOxend35PQ/rxDbZFEol3e1lwD5bcqIpAFMSgbGPI+bPvw/IV+rks7Mb3bc8AUGsbRQ9qD3N++NGE6duzwfTtk+IVCJ4qlYAVyEnzPXD7y4mQS1FXGMq1oNL8CA== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(396003)(346002)(39860400002)(46966005)(110136005)(36906005)(26005)(5660300002)(70206006)(55016002)(9686003)(54906003)(70586007)(336012)(7696005)(186003)(86362001)(316002)(8936002)(8676002)(478600001)(81166007)(4326008)(82740400003)(82310400002)(2906002)(52536014)(6506007)(33656002)(83380400001)(356005)(47076004); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2020 04:54:35.4062 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea9820e9-22d6-42f8-b5cc-08d8350dd275 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5017 Subject: Re: [dpdk-dev] [PATCH] librte_metrics: fix memory leak 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Gaurav, One comment inline. >=20 > Fix memory leak for sequential allocations. >=20 > Signed-off-by: Gaurav Singh > --- > lib/librte_metrics/rte_metrics_telemetry.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_metrics/rte_metrics_telemetry.c > b/lib/librte_metrics/rte_metrics_telemetry.c > index 289ebae0b..55c2b8478 100644 > --- a/lib/librte_metrics/rte_metrics_telemetry.c > +++ b/lib/librte_metrics/rte_metrics_telemetry.c > @@ -167,9 +167,15 @@ rte_metrics_tel_format_port(uint32_t pid, json_t > *ports, > } >=20 > metrics =3D malloc(sizeof(struct rte_metric_value) * num_metrics); > + if (metrics =3D=3D NULL) { > + METRICS_LOG_ERR("Cannot allocate memory"); > + return -ENOMEM; > + } > + > names =3D malloc(sizeof(struct rte_metric_name) * num_metrics); > - if (metrics =3D=3D NULL || names =3D=3D NULL) { > + if (names =3D=3D NULL) { > METRICS_LOG_ERR("Cannot allocate memory"); > + free(metrics); > return -ENOMEM; > } There is a similar error in function 'rte_metrics_tel_reg_port_ethdev_to_me= trics', can you fix that as well? >=20 > -- > 2.17.1