]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
util/cleanup: Add cleanup for struct nvme_fabrics_uri
authorTomas Bzatek <tbzatek@redhat.com>
Wed, 24 Apr 2024 15:47:02 +0000 (17:47 +0200)
committerDaniel Wagner <wagi@monom.org>
Thu, 13 Jun 2024 17:13:11 +0000 (19:13 +0200)
libnvme cleanup definitions are not part of public API.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
util/cleanup.h

index c1e0394dc9e7ca772c3b631535b3f7e6919ff538..36200f2895964bd46cf28dc9a6300ce024bddd75 100644 (file)
@@ -43,4 +43,12 @@ static inline void cleanup_nvme_root(nvme_root_t *r)
 }
 #define _cleanup_nvme_root_ __cleanup__(cleanup_nvme_root)
 
+static inline void free_uri(struct nvme_fabrics_uri **uri)
+{
+       if (*uri)
+               nvme_free_uri(*uri);
+}
+
+#define _cleanup_uri_ __cleanup__(free_uri)
+
 #endif