From: Boris Kolpackov <boris@codesynthesis.com>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kconfig: fix memory leak from range properties
Date: Thu, 16 Nov 2023 14:28:57 +0200 [thread overview]
Message-ID: <boris.20231116141906@codesynthesis.com> (raw)
In-Reply-To: <20231115041653.810045-1-masahiroy@kernel.org>
Masahiro Yamada <masahiroy@kernel.org> writes:
> Currently, sym_validate_range() duplicates the range string using
> xstrdup(), which is overwritten by a subsequent sym_calc_value() call.
> It results in a memory leak.
>
> [After]
>
> LEAK SUMMARY:
> definitely lost: 0 bytes in 0 blocks
> indirectly lost: 0 bytes in 0 blocks
> possibly lost: 0 bytes in 0 blocks
> still reachable: 17,462 bytes in 20 blocks
> suppressed: 0 bytes in 0 blocks
FYI, there are quite a few other memory leaks in Kconfig (as evident from
the still reachable value in the above report). I believe I've fixed most
of them in this commit:
https://github.com/build2-packaging/kconfig/commit/cd9910e3636515b2980ce1d37d1984ccfd6b4cb9
In particular, I could load the Linux kernel configuration repeatedly
in a loop without causing any memory leaks or crashes (which were common
due to the state not being reset properly).
I believe the above commit also includes a fix for the sym_validate_range()
leak in question, though the way it's fixed is different. The potential
problem with the proposed fix is that it may be impossible to decide who
should free the shared value.
prev parent reply other threads:[~2023-11-16 12:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-15 4:16 [PATCH] kconfig: fix memory leak from range properties Masahiro Yamada
2023-11-16 12:28 ` Boris Kolpackov [this message]
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=boris.20231116141906@codesynthesis.com \
--to=boris@codesynthesis.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox