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 B7CA246130; Fri, 24 Jan 2025 19:17:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BA87942D7B; Fri, 24 Jan 2025 19:17:27 +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 2D8124279B for ; Fri, 24 Jan 2025 19:17:22 +0100 (CET) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2165cb60719so43521815ad.0 for ; Fri, 24 Jan 2025 10:17:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737742641; x=1738347441; 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=eUkfFxUp0mnwBzVkcPamGMI/9Vqc3APc0qqtuVbVrvA=; b=v4dF7mGDIbSyuLNM0q9MD6RcJiL1EBKXN2Z3OBlz1xRGzaULZ1nXjNqxnshW8pjFRu Z7mLdnvjLTHHEmFmpbC646ZPcijuSM9rSlwe4cUYOntP7PkYsTEmW6Wr51ZT6teWfoMq qQaO2oZGBlNsGnP4l/NG4TdjNvTdIfxFsfSrwDOdyP3m9PPN64Muw64s+qLKIXZFi/as XMQPI1pY3ciCxpFAC29Hm6RdfVfNTLdb90idRUqTWkF7H9kb520jxhM0upl9MKLRqdLp DW21UHTomdPN7WKoK1j3NaPBZGH78w3ZKjQI9tc3HwD2W1vYdfzP1o2yvITu/XAhQX4G ZgVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737742641; x=1738347441; 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=eUkfFxUp0mnwBzVkcPamGMI/9Vqc3APc0qqtuVbVrvA=; b=NJa1zNjdpm5b2k6KGCTd6/9Tb7XtVAsE5jIioP6c3etxCD4A0Irf+HTYOvfcVaHkrT MZBpz6NiRps/MPrqifP+fyFdz2daV5MB9bQ9CA8ewPLE34WzKyJB47PW4/DgyQyogHVV 3xl/XmNbkLcXLkDZKeF3ACLehExT2ABLzkvmT7oDK5/o1JxsXtBrIOm0gRzRIwqYgK1f BXch1rBwG/4ufO9jn7eJ7rY6LpiF8b8JcwBRg7/K8f/s1KP0jqsGlUwzrFEc0ZBV+xVD LfkHeQMeOE+KHzgQnLB0THlE1fibWDZQNMeHhyz/5fDMytg6I937E8UPie6QG3Sqrn/0 ujBQ== X-Gm-Message-State: AOJu0YxmYzE8aQ05NCUCkhhfKSSDA8aaZX9K0yjivHOUkMWmpIvcjSz7 00eKDAsm0Uy7+QgApvH7Vh0UMlv46Khd3ll2ZOs6RjVd56Ry71tbWXjY+LJfoLHba4ELExyI8X0 B X-Gm-Gg: ASbGnctp8cgpalXQ6BOk1bVlQ2esKfMH7sN4S/m/Fmm8m60PdpAlS9KjvL0ERkg3qu8 EtonFVNkC03PVSdYUzr1CO6/RA4DtSOz9xf5brmk4yA6omk8w8qj3vqQqxsqvNobANfr56UB0R/ unHjK2lR5tLgHEvpuRz6p8JjV+mijopTPWFEv5UHS7euloAazkLmVFn0I2MBKViMnb44hFI8ooV SX2Y7TxpcKrLLSy9Zn0Oeriniq26HTsIHA6J8CxPJbGQhBG0hTbhwB2M/bENH9FBY5JdbWl2x8S txpU0QeDRa2uA6EZOgI2V+2lEJEErFeuBvb2kwXlMrUSB4zVfenM9N4/gg== X-Google-Smtp-Source: AGHT+IHJu3TYXnPLyyxk1gUSpJqTihTkYk5GMGNb8Q9oBeCTI3iFDu0cu4W9ZFmue5gCho+ZJPffVQ== X-Received: by 2002:a05:6a00:be0:b0:72f:59d8:43ed with SMTP id d2e1a72fcca58-72f59d84743mr18310228b3a.14.1737742641464; Fri, 24 Jan 2025 10:17:21 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a6b2ed8sm2184477b3a.41.2025.01.24.10.17.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 10:17:21 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v4 07/16] bitratestats: add allocation function attributes Date: Fri, 24 Jan 2025 10:14:58 -0800 Message-ID: <20250124181704.86567-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250124181704.86567-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250124181704.86567-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 | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/bitratestats/rte_bitrate.h b/lib/bitratestats/rte_bitrate.h index 979a712837..75883f8779 100644 --- a/lib/bitratestats/rte_bitrate.h +++ b/lib/bitratestats/rte_bitrate.h @@ -7,6 +7,8 @@ #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -17,16 +19,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 +28,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