From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Joel Stanley <joel@jms.id.au>
Cc: "open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [libgpiod PATCH] gpioinfo: Clean up scandir allocations
Date: Fri, 18 Feb 2022 19:37:34 +0100 [thread overview]
Message-ID: <CAMRc=Mev4oS3CDWhCrUdW3=fGwMuWPVJGo8TAwgDmFSeyBu-Bw@mail.gmail.com> (raw)
In-Reply-To: <20220202120123.33727-1-joel@jms.id.au>
On Wed, Feb 2, 2022 at 1:01 PM Joel Stanley <joel@jms.id.au> wrote:
>
> ==3017== 176 (80 direct, 96 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 2
> ==3017== at 0x483F6C7: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==3017== by 0x491CE92: ??? (in /lib/libc.so.6)
> ==3017== by 0x10AAAC: main (gpioinfo.c:215)
>
> The entires must be freed, and then the array itself.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
> tools/gpioinfo.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/gpioinfo.c b/tools/gpioinfo.c
> index 3d8911176281..d50af45dbf35 100644
> --- a/tools/gpioinfo.c
> +++ b/tools/gpioinfo.c
> @@ -231,7 +231,9 @@ int main(int argc, char **argv)
> list_lines(chip);
>
> gpiod_chip_unref(chip);
> + free(entries[i]);
> }
> + free(entries);
> } else {
> for (i = 0; i < argc; i++) {
> chip = chip_open_lookup(argv[i]);
> --
> 2.34.1
>
Applied, thanks!
Bart
prev parent reply other threads:[~2022-02-18 18:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-02 12:01 [libgpiod PATCH] gpioinfo: Clean up scandir allocations Joel Stanley
2022-02-18 18:37 ` Bartosz Golaszewski [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='CAMRc=Mev4oS3CDWhCrUdW3=fGwMuWPVJGo8TAwgDmFSeyBu-Bw@mail.gmail.com' \
--to=brgl@bgdev.pl \
--cc=joel@jms.id.au \
--cc=linux-gpio@vger.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;
as well as URLs for NNTP newsgroup(s).