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 CFCDF4601A; Mon, 20 Jan 2025 19:06:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E992E427AA; Mon, 20 Jan 2025 19:06:09 +0100 (CET) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id CBAD042789 for ; Mon, 20 Jan 2025 19:06:05 +0100 (CET) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2164b1f05caso86031985ad.3 for ; Mon, 20 Jan 2025 10:06:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737396365; x=1738001165; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kwaiY4FFzgmt7469ha9uhsQBQXIyPo7f4XK3Y3dMv84=; b=zIVnApQ2PenR34Lqao5nfVn3/2FUFy3z2K26h1NK78rEdJ5Y7PqdlMPuEL1HrLql5K DW1jbJRnBlmJwkq06TnFxQQzuoTwBaF4T+b0RZX2BnyAN1xDKIs+hGc+nkEW9PX2KT/F PXseIrvqgI5fTU6yWXicifb59wmAJ0Fdccx+m47JxTsWDfOJSlAckfSy6edCSB8hemuX FIm0zpjrZHxNrdTySvfi7jJyiD6JszmMoJ5Q28jJvWKg97T1l20XWlG141DmLJcmUPRO eZyv8CEQr5GMsKSAZf7TApW1mTpUCnMscDWBPcP/tiUy5G4NqepX3bNqT4JTVFspKA+/ pqOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737396365; x=1738001165; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kwaiY4FFzgmt7469ha9uhsQBQXIyPo7f4XK3Y3dMv84=; b=WmzZf/8C9MFzEAJVueCmCGCbyKsvMbI2PwGsY0XjHh8onOeDTqb7lDJUuIVW1GpwWY iZ0vQZWNs1hqRFOAYAgPO8DVmXltxacGHwmtzWtS6BmL15KE0l0X/wodb8ldrcNP9/zV bBXcaiV4biyasVogMhJu0kOQg8St2aLI3GHBJ70BCdGbNpsIxRJXV1+sHILGRo8XNx6n fTIzpPCxgetR9c7JfZkksukZcbOdW7zhQI50Z2WrgRP29qeOteNsjQqBDOVqQrjeTmT5 9VXUA0UBWNZHnAAIszjJsyjU12zuxWRinsnIXBsmYAhWnCYaE5SnC2AUGsA2sRibgXEG mZ4w== X-Gm-Message-State: AOJu0YzqZx0NC/sBqEn6zIyWlRkj9LFy0f36pBHRNK/oapeJXlEyCh13 RDUHGhQHPDPsnBld+07+uR7AeDEC2XId2K5VZREJ66GR09VEMR7skwHmp+90QlmRjStONHsXdH1 m X-Gm-Gg: ASbGncuxAmSm+Zz3Ay9qxwWEz6w1qcyE9FzCZIWZoWFrPC7Wo+4flpYjB3L5vZOq8ZF 0U3y+obQ0ng5eDCSnftB0G9oXuJJOT6A0oHMYM566Hs/LcyJMduwOyuq1gWC7zPCw+GRiBVmAWu nf+BS+ei7dsxlsqvVb+BC5C8qTILGob2LpD3tmZOLHefdmasWgIjY5OQKFjXLKqy6ll/QT8sbM8 EmRkpeBmxsHA3aatzoy9f7xkydAM1fypF7qN9Vh/FDIYz4inUyGosDRpm39IH7uuVE52FsCgt7L bex38tC/Zkwwi3UhsK7PZK6NiJAo0cbkcaNWK3k6L0l4kP0= X-Google-Smtp-Source: AGHT+IHy47RVoyaFCsb9WDv0Satq29i04uaFI3WMGM+VMob4TrsGags99cj5hnWQGwt4ACXp1fcqXQ== X-Received: by 2002:a05:6a20:9149:b0:1e5:ddac:1ed7 with SMTP id adf61e73a8af0-1eb2147ea8dmr20879843637.12.1737396365022; Mon, 20 Jan 2025 10:06:05 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72dab848b08sm7393982b3a.71.2025.01.20.10.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 10:06:04 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH 07/15] bitratestats: add allocation function attributes Date: Mon, 20 Jan 2025 10:03:25 -0800 Message-ID: <20250120180550.198121-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250120180550.198121-1-stephen@networkplumber.org> References: <20250120180550.198121-1-stephen@networkplumber.org> 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Use function attributes to catch cases where bitratestats is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- lib/bitratestats/rte_bitrate.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/bitratestats/rte_bitrate.h b/lib/bitratestats/rte_bitrate.h index 979a712837..27951f3e28 100644 --- a/lib/bitratestats/rte_bitrate.h +++ b/lib/bitratestats/rte_bitrate.h @@ -17,16 +17,6 @@ extern "C" { */ struct rte_stats_bitrates; - -/** - * Allocate a bitrate statistics structure - * - * @return - * - Pointer to structure on success - * - NULL on error (zmalloc failure) - */ -struct rte_stats_bitrates *rte_stats_bitrate_create(void); - /** * Free bitrate statistics structure * @@ -36,6 +26,16 @@ struct rte_stats_bitrates *rte_stats_bitrate_create(void); */ void rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data); +/** + * Allocate a bitrate statistics structure + * + * @return + * - Pointer to structure on success + * - NULL on error (zmalloc failure) + */ +struct rte_stats_bitrates *rte_stats_bitrate_create(void) + __rte_malloc __rte_dealloc(rte_stats_bitrate_free, 1); + /** * Register bitrate statistics with the metric library. * -- 2.45.2