Re: [PATCH -next] acpi/hmat: fix memory leaks in hmat_init()

From: Qian Cai
Date: Tue Apr 09 2019 - 11:33:23 EST


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.

status = acpi_get_table(ACPI_SIG_SRAT
acpi_put_table(tbl);
status = acpi_get_table(ACPI_SIG_HMAT

If acpi_get_table(ACPI_SIG_SRAT failed, there is no point calling
acpi_put_table(), so what is the point checking return value of acpi_get_table()
for SRATÂafter acpi_put_table() ?