valgrinds reports that the nvme_ctrl_t is leaked in the connect command.
Let's introduced a new cleanup helper for this.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
unsigned int verbose = 0;
_cleanup_nvme_root_ nvme_root_t r = NULL;
nvme_host_t h;
- nvme_ctrl_t c;
+ _cleanup_nvme_ctrl_ nvme_ctrl_t c = NULL;
int ret;
nvme_print_flags_t flags;
struct nvme_fabrics_config cfg = { 0 };
}
#define _cleanup_nvme_root_ __cleanup__(cleanup_nvme_root)
+static inline DEFINE_CLEANUP_FUNC(cleanup_nvme_ctrl, nvme_ctrl_t, nvme_free_ctrl)
+#define _cleanup_nvme_ctrl_ __cleanup__(cleanup_nvme_ctrl)
+
static inline void free_uri(struct nvme_fabrics_uri **uri)
{
if (*uri)