From d1f0b89e65fd8817930bbf89051fe03efb0a1db5 Mon Sep 17 00:00:00 2001
From: Marian Csontos <mcsontos@redhat.com>
Date: Tue, 28 Nov 2023 21:41:35 +0100
Subject: [PATCH] dmstats: Fix memory leak on error path

---
 libdm/libdm-stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index dc2907f..62be5de 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -1970,7 +1970,7 @@ static int _stats_create_region(struct dm_stats *dms, uint64_t *region_id,
 				 (strlen(hist_arg)) ? HISTOGRAM_ARG : "",
 				 hist_arg)) < 0) {
 			log_error(err_fmt, PRECISE_ARG " option.");
-			return 0;
+			goto out;
 		}
 	} else
 		opt_args = dm_strdup("");
-- 
2.27.0

