All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Wilfred Mallawa <wilfred.mallawa@wdc.com>,
	"cem@kernel.org" <cem@kernel.org>,
	"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>
Subject: Re: [xfsprogs] mkfs: fixup memory leak on exit
Date: Thu, 8 Oct 2026 00:17:36 -0700	[thread overview]
Message-ID: <asdDkOgueZHx0UVz@infradead.org> (raw)
In-Reply-To: <20261006144851.GX2705364@frogsfrogsfrogs>

On Tue, Oct 06, 2026 at 07:48:51AM -0700, Darrick J. Wong wrote:
> 
> I don't think this is better.  libxfs' init functions do not create or
> assign the libxfs_init.{data,log,rt}.name fields, they merely reuse
> whatever pointer the calling program set.  Only the caller knows where
> that pointed to memory came from (stack, optarg, dynamic allocation) so
> only the caller knows how to drop the pointer.

Exactly.

> The original patch is more appropriate IMO but seeing as we're about to
> return from main and terminate the process, why do we care?  And if we
> do, shouldn't mkfs also free the other getstr() strings attached to the
> cli struct?

We probably want that, as having a clean xfstests run with addrsan is
actually really nice to have, as without that the addrsan support is
only if limited use.

> And shouldn't the exit(1) paths do likewise?

Maybe.  Although it doesn't really matter all that much.


  parent reply	other threads:[~2026-10-08  7:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=asdDkOgueZHx0UVz@infradead.org \
    --to=hch@infradead.org \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=wilfred.mallawa@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.