* [ndctl PATCH] libdaxctl: free resource allocated with asprintf()
@ 2022-03-04 0:01 alison.schofield
0 siblings, 0 replies; only message in thread
From: alison.schofield @ 2022-03-04 0:01 UTC (permalink / raw)
To: Vishal Verma, Dan Williams; +Cc: Alison Schofield, nvdimm
From: Alison Schofield <alison.schofield@intel.com>
Static analysis reported this resource leak.
Fixes: d07508a0cc3c ("libdaxctl: add daxctl_region_create_dev()")
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
daxctl/lib/libdaxctl.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
index f173bbb7c514..5703992f5b88 100644
--- a/daxctl/lib/libdaxctl.c
+++ b/daxctl/lib/libdaxctl.c
@@ -624,10 +624,9 @@ DAXCTL_EXPORT int daxctl_region_create_dev(struct daxctl_region *region)
}
rc = sysfs_write_attr(ctx, path, num_devices);
- if (rc)
- return rc;
+ free(num_devices);
- return 0;
+ return rc;
}
DAXCTL_EXPORT int daxctl_region_destroy_dev(struct daxctl_region *region,
base-commit: 3b5fb8b6428dfaab39bab58d67412427f514c1f4
--
2.31.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-03 23:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-04 0:01 [ndctl PATCH] libdaxctl: free resource allocated with asprintf() alison.schofield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox