Blame SOURCES/0144-libdaxctl-free-resource-allocated-with-asprintf.patch

2eb93d
From 057ca6fc2ce63625236bf00e795e0847e6508ed8 Mon Sep 17 00:00:00 2001
2eb93d
From: Alison Schofield <alison.schofield@intel.com>
2eb93d
Date: Thu, 3 Mar 2022 16:01:33 -0800
2eb93d
Subject: [PATCH 144/217] libdaxctl: free resource allocated with asprintf()
2eb93d
2eb93d
Static analysis reported this resource leak.
2eb93d
2eb93d
Link: https://lore.kernel.org/r/20220304000133.1053883-1-alison.schofield@intel.com
2eb93d
Fixes: d07508a0cc3c ("libdaxctl: add daxctl_region_create_dev()")
2eb93d
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
2eb93d
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
2eb93d
---
2eb93d
 daxctl/lib/libdaxctl.c | 5 ++---
2eb93d
 1 file changed, 2 insertions(+), 3 deletions(-)
2eb93d
2eb93d
diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
2eb93d
index f173bbb..5703992 100644
2eb93d
--- a/daxctl/lib/libdaxctl.c
2eb93d
+++ b/daxctl/lib/libdaxctl.c
2eb93d
@@ -624,10 +624,9 @@ DAXCTL_EXPORT int daxctl_region_create_dev(struct daxctl_region *region)
2eb93d
 	}
2eb93d
 
2eb93d
 	rc = sysfs_write_attr(ctx, path, num_devices);
2eb93d
-	if (rc)
2eb93d
-		return rc;
2eb93d
+	free(num_devices);
2eb93d
 
2eb93d
-	return 0;
2eb93d
+	return rc;
2eb93d
 }
2eb93d
 
2eb93d
 DAXCTL_EXPORT int daxctl_region_destroy_dev(struct daxctl_region *region,
2eb93d
-- 
2eb93d
2.27.0
2eb93d