Skip to content

Commit

Permalink
libdaxctl: free resource allocated with asprintf()
Browse files Browse the repository at this point in the history
Static analysis reported this resource leak.

Link: https://lore.kernel.org/r/[email protected]
Fixes: d07508a ("libdaxctl: add daxctl_region_create_dev()")
Signed-off-by: Alison Schofield <[email protected]>
Signed-off-by: Vishal Verma <[email protected]>
  • Loading branch information
AlisonSchofield authored and stellarhopper committed Mar 4, 2022
1 parent 4b381a3 commit 057ca6f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions daxctl/lib/libdaxctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 057ca6f

Please sign in to comment.