All of
 help / color / mirror / Atom feed
From: Edmundo Carmona Antoranz <>
To: Christophe JAILLET <>
Subject: Re: [PATCH] ACPI: scan: Fix a memory leak in an error handling path
Date: Sat, 8 May 2021 08:50:44 -0600	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Sat, May 8, 2021 at 1:23 AM Christophe JAILLET
<> wrote:
> If 'acpi_device_set_name()' fails, we must free
> 'acpi_device_bus_id->bus_id' or there is a (potential) memory leak.

This is a question about the style used in kernel. This function
(acpi_device_add) initializes acpi_device_bus_id and it could also
initialize acpi_device_bus_id->bus_id and any of those might fail. And
they will have to be freed if they are initialized and so on. I see
that there are kfrees used for them in different places before using a
goto err_unlock; I wonder if it is accepted practice to avoid doing
these kfrees and have them in a single place instead, something like:

    if (acpi_device_bus_id) {
        if (acpi_device_bus_id->bus_id)

Thanks in advance.

  reply	other threads:[~2021-05-08 14:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08  7:23 Christophe JAILLET
2021-05-08 14:50 ` Edmundo Carmona Antoranz [this message]
2021-05-08 18:47   ` Christophe JAILLET
2021-05-10  5:39   ` Dan Carpenter
     [not found]     ` <>
2021-05-10 13:55       ` Dan Carpenter
2021-05-10 12:18 ` Andy Shevchenko
2021-05-10 17:04   ` Rafael J. Wysocki

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:

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

  git send-email \ \ \ \ \
    --subject='Re: [PATCH] ACPI: scan: Fix a memory leak in an error handling path' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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.