Re: [PATCH] ACPI: PM: s2idle: Fix memory leak in lpi_device_get_constraints()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 19, 2025 at 9:36 AM Kaushlendra Kumar
<kaushlendra.kumar@xxxxxxxxx> wrote:
>
> Add proper cleanup of lpi_constraints_table to prevent memory leaks
> when  the driver is reloaded

Which driver do you mean?

> or lpi_device_get_constraints() is called multiple times.

How exactly?

> The function lpi_device_get_constraints() allocates memory for
> lpi_constraints_table using kcalloc() but never frees any previously
> allocated memory. This leads to a memory leak on subsequent calls to
> the function.

What subsequent calls?

> Fix this by:
> 1. Adding a new helper function lpi_constraints_table_free() that properly
>    frees the allocated memory and resets the table pointer and size
> 2. Calling this cleanup function before allocating new memory in
>    lpi_device_get_constraints()
>
> This ensures that any previously allocated lpi_constraints_table is
> properly freed before allocating a new one, preventing memory leaks.

No, really.

You need to say how exactly the memory is leaked, or there is nothing to fix.

Thanks!





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux