[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jSutxp0jadaj3d2rR+2i4xX7BHaf6g0o_UDQ4-decw8g@mail.gmail.com>
Date: Tue, 9 Apr 2019 23:34:40 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Qian Cai <cai@....pw>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>,
Keith Busch <keith.busch@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] acpi/hmat: fix memory leaks in hmat_init()
On Tue, Apr 9, 2019 at 5:33 PM Qian Cai <cai@....pw> wrote:
>
> On Tue, 2019-04-09 at 16:54 +0200, Rafael J. Wysocki wrote:
> > Fewer jumps are easier to follow in general, so avoiding ones that can
> > be avoided is helpful.
> >
> > I'm not buying the argument about more code line changes needed if the
> > function name changes. It's meaningless.
> >
> > And if you check the return value of acpi_get_table() for SRAT after
> > calling acpi_put_table(tbl), you will only need the out_free label, if
> > I'm not mistaken.
>
> I don't really understand this.
Sorry, I didn't have the original code in front of me when I was
writing my reply.
I was thinking about checking the return value of
acpi_table_parse_entries() after calling acpi_put_table(tbl). Then,
if it returns an error, you only need to call hmat_free_structures().
Similarly, if acpi_get_table(ACPI_SIG_HMAT, 0, &tbl) returns an error,
you only need to call hmat_free_structures().
But I didn't remember the other jumps to out_put.
Still, since it is valid to pass NULL to acpi_put_table(), you can
jump to out_put if acpi_get_table(ACPI_SIG_HMAT, 0, &tbl) returns an
error too.
Powered by blists - more mailing lists