linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.de.marchi@gmail.com>
To: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Cc: linux-modules <linux-modules@vger.kernel.org>
Subject: Re: [PATCH 1/3] libkmod: kmod_builtin_get_modinfo: free modinfo on error
Date: Tue, 1 Dec 2020 02:06:50 -0800	[thread overview]
Message-ID: <CAKi4VA+kaWfLZ_Ue-teaJAvDQjfM6G-WK3KmMWVinR-Zg6T64A@mail.gmail.com> (raw)
In-Reply-To: <20201129164737.135866-1-yauheni.kaliuta@redhat.com>

Thanks, those 3 fixes were applied.

Lucas De Marchi

On Sun, Nov 29, 2020 at 8:47 AM Yauheni Kaliuta
<yauheni.kaliuta@redhat.com> wrote:
>
> The function allocates array but on building it if get_string()
> fails it returns the error leaving the array allocated. The caller
> does not care about it in error case either.
>
> Free it to fix memory leak.
>
> Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
> ---
>  libkmod/libkmod-builtin.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libkmod/libkmod-builtin.c b/libkmod/libkmod-builtin.c
> index aaec5ddb0609..fc9a37644261 100644
> --- a/libkmod/libkmod-builtin.c
> +++ b/libkmod/libkmod-builtin.c
> @@ -314,6 +314,7 @@ ssize_t kmod_builtin_get_modinfo(struct kmod_ctx *ctx, const char *modname,
>                 offset = get_string(iter, pos, &line, &linesz);
>                 if (offset <= 0) {
>                         count = (offset) ? -errno : -EOF;
> +                       free(*modinfo);
>                         goto fail;
>                 }
>
> --
> 2.29.2
>

      parent reply	other threads:[~2020-12-01 10:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-29 16:47 Yauheni Kaliuta
2020-11-29 16:47 ` [PATCH 2/3] depmod: output_builtin_alias_bin: free idx on error path Yauheni Kaliuta
2020-11-29 16:47 ` [PATCH 3/3] libkmod: kmod_log_null: qualify ctx argument as const Yauheni Kaliuta
2020-12-01 10:06 ` Lucas De Marchi [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=CAKi4VA+kaWfLZ_Ue-teaJAvDQjfM6G-WK3KmMWVinR-Zg6T64A@mail.gmail.com \
    --to=lucas.de.marchi@gmail.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=yauheni.kaliuta@redhat.com \
    --subject='Re: [PATCH 1/3] libkmod: kmod_builtin_get_modinfo: free modinfo on error' \
    /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

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).