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 AB6B7460FF; Thu, 23 Jan 2025 17:31:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9FFF40DCE; Thu, 23 Jan 2025 17:30:31 +0100 (CET) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mails.dpdk.org (Postfix) with ESMTP id 2A41940B9D for ; Thu, 23 Jan 2025 17:30:24 +0100 (CET) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-216281bc30fso27055105ad.0 for ; Thu, 23 Jan 2025 08:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737649823; x=1738254623; 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=dk3bfSJvQNGL7V+Wy1d7dOCpZb//fXg83eIxlhoBynzBljiDWpYBVNVHqEMAcyjMVR RHvlTrDzFV8Pof76SOpSohCqB/ZDlAegmhNl1LEoyTDRtGdWqdsoTts7bYmq5s+cBuV6 FxeVIZlHzLPh4cxmrDnDGApBmc2G5lx1y8TR1xdbJAjy0O67C1jT4NMIPRpGz9BkuVvB NDvTm9PPmXnue8DzLC71WnEOK2DTYlDWCY37WUa6mAFubnViwjLJRyv+QG6OeosWlK5l ZhQUyl338unlOXt0/YKioaZQ0VmXu/tiKtkBD2SchWKTXcWYnw/vEkxd5JE1JrEi6yD1 gPWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737649823; x=1738254623; 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=f4Y/TeKRMt8fXwGsRKInf9CGChiBVxYC3DB9qUiAc2CJg4+YFaMT0J1d6tsq1nxNjL ymnipQkNdioVLXoL7lAiqxycjrRkvSop3POskqudyBM3/aUA783BsL/4sf7D4Pc7PDh4 1mX/qKYTJk9TD3HE+h2MUCIFdcOL03hb8TOr3qx/sl87JaQ87+M8K0LI/ZP/mzy+gh1t KD7DbTPG9rJPQVSSj4m1JyvoE154wd4BB3WvBYy4uIJt65BioHbHfazq5yJweooxHrt6 D/sAF6QAb67Hjml3/ZpCKMHVE3XQ+bv7e0N7C0NBZtCHa3/DQZBPZ1RAaSfopEmdTy0t vTMA== X-Gm-Message-State: AOJu0YzpVSf9QmXAf0EBCOmw4wnjtsvQSFPteh1Fj0JE4vaa+BYPzeBN 7xkKQea/Kc5BgPS+SZCytcPGNQN9c1WiE0z+LIOfctEoYBlBKcOiORBcUVqdY9+8uRVyUGEYUTT X X-Gm-Gg: ASbGncv54mk8JQCTegXppGy30J9LQBwh2j8x6TisncyxbE+rGmV3tY1VfBnA04qqA9p 1km8tG4fmML88lk8YmlPVM4L3DDL/4WCI1400kUrzwjIEE6EhiL9/Kt22nY7an3kFk/vzibchSH B0BEyHpX1pbdEvcBmPAyuuUO6aiP2WS3SxCMw7QzUriRMlIQaPDQl4dVtVKdpB8Avehm6PRwFcN 9pvu2uA0/3/gfWT2Tv28jl1FvV6/VKwjaGTiBVnKI52gIl20TCKmqY/oQaNvbQRAT4NWOjnoue5 mulDexI/6gAUU0KbYjK5i0NxTcaIFHcHKReamK4DO3u9nMLNdNYtQZJxaw== X-Google-Smtp-Source: AGHT+IE2edrmPWOtFfVqupvP1rFhTRYFpbQro7mJ3X3+MBLmogL8zUzdapl1Yqt3pVLBsjjww+TBwA== X-Received: by 2002:a05:6a20:841b:b0:1e1:af74:a236 with SMTP id adf61e73a8af0-1eb214de89emr39954459637.21.1737649823355; Thu, 23 Jan 2025 08:30:23 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ac4907f076dsm64601a12.37.2025.01.23.08.30.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 08:30:23 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v3 07/15] bitratestats: add allocation function attributes Date: Thu, 23 Jan 2025 08:28:07 -0800 Message-ID: <20250123163003.23394-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250123163003.23394-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250123163003.23394-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