All of lore.kernel.org
 help / color / mirror / Atom feed
* [xfsprogs] mkfs: fixup memory leak on exit
@ 2026-10-06 10:12 Wilfred Mallawa
  2026-10-06 10:51 ` Carlos Maiolino
  0 siblings, 1 reply; 10+ messages in thread
From: Wilfred Mallawa @ 2026-10-06 10:12 UTC (permalink / raw)
  To: linux-xfs; +Cc: Wilfred Mallawa

From: Wilfred Mallawa <wilfred.mallawa@wdc.com>

When running mkfs.xfs with addrsan enabled, the following is reported:

```
==27832==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x7fe6db2e8ac4 in strdup (/lib64/libasan.so.8+0xe8ac4) (BuildId: 5395ec74f54d9ec7bf97c06583dd39a96c230822)
    #1 0x0000004175ce in getstr <blah>/mkfs/xfs_mkfs.c:1767

SUMMARY: AddressSanitizer: 9 byte(s) leaked in 1 allocation(s).
```

Thus, gracefully clean up these string allocation on exit to address the above.

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
---
 mkfs/xfs_mkfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 334367b8..fec43987 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -6503,5 +6503,8 @@ main(
 		exit(1);
 
 	libxfs_destroy(&xi);
+	free(cli.xi->data.name);
+	free(cli.xi->log.name);
+	free(cli.xi->rt.name);
 	return 0;
 }
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-10-12  0:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-06 10:12 [xfsprogs] mkfs: fixup memory leak on exit Wilfred Mallawa
2026-10-06 10:51 ` Carlos Maiolino
2026-10-06 13:52   ` Wilfred Mallawa
2026-10-06 14:48     ` Darrick J. Wong
2026-10-06 15:20       ` Wilfred Mallawa
2026-10-08  7:17       ` Christoph Hellwig
2026-10-08 11:20       ` Carlos Maiolino
2026-10-11  1:32         ` Wilfred Mallawa
2026-10-11  7:09           ` Carlos Maiolino
2026-10-12  0:43             ` Wilfred Mallawa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.