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

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