iASL: fix memory leak of LocalityBuffer on error return path
diff mbox series

Message ID 20191030092657.1237-1-colin.king@canonical.com
State Accepted
Headers show
Series
  • iASL: fix memory leak of LocalityBuffer on error return path
Related show

Commit Message

Colin King Oct. 30, 2019, 9:26 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The error return path is not free'ing previously allocated
resource LocalityBuffer and hence there is a memory leak. Fix this
by free'ing it before returning.

Fixes: c22c0b1df98c ("Data table compiler: Add error messages for SLIT locality buffers")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpica/source/compiler/dttable2.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Alex Hung Oct. 31, 2019, 4:55 a.m. UTC | #1
On 2019-10-30 3:26 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The error return path is not free'ing previously allocated
> resource LocalityBuffer and hence there is a memory leak. Fix this
> by free'ing it before returning.
> 
> Fixes: c22c0b1df98c ("Data table compiler: Add error messages for SLIT locality buffers")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpica/source/compiler/dttable2.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/acpica/source/compiler/dttable2.c b/src/acpica/source/compiler/dttable2.c
> index bbaaafaa..550cca13 100644
> --- a/src/acpica/source/compiler/dttable2.c
> +++ b/src/acpica/source/compiler/dttable2.c
> @@ -1662,6 +1662,7 @@ DtCompileSlit (
>              "Found %u entries, must match LocalityCount: %u",
>              LocalityListLength, Localities);
>          DtError (ASL_ERROR, ASL_MSG_ENTRY_LIST, EndOfFieldList, AslGbl_MsgBuffer);
> +        ACPI_FREE (LocalityBuffer);
>          return (AE_LIMIT);
>      }
>  
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
ivanhu Nov. 7, 2019, 7:48 a.m. UTC | #2
On 10/30/19 5:26 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The error return path is not free'ing previously allocated
> resource LocalityBuffer and hence there is a memory leak. Fix this
> by free'ing it before returning.
>
> Fixes: c22c0b1df98c ("Data table compiler: Add error messages for SLIT locality buffers")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpica/source/compiler/dttable2.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/acpica/source/compiler/dttable2.c b/src/acpica/source/compiler/dttable2.c
> index bbaaafaa..550cca13 100644
> --- a/src/acpica/source/compiler/dttable2.c
> +++ b/src/acpica/source/compiler/dttable2.c
> @@ -1662,6 +1662,7 @@ DtCompileSlit (
>              "Found %u entries, must match LocalityCount: %u",
>              LocalityListLength, Localities);
>          DtError (ASL_ERROR, ASL_MSG_ENTRY_LIST, EndOfFieldList, AslGbl_MsgBuffer);
> +        ACPI_FREE (LocalityBuffer);
>          return (AE_LIMIT);
>      }
>  

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch
diff mbox series

diff --git a/src/acpica/source/compiler/dttable2.c b/src/acpica/source/compiler/dttable2.c
index bbaaafaa..550cca13 100644
--- a/src/acpica/source/compiler/dttable2.c
+++ b/src/acpica/source/compiler/dttable2.c
@@ -1662,6 +1662,7 @@  DtCompileSlit (
             "Found %u entries, must match LocalityCount: %u",
             LocalityListLength, Localities);
         DtError (ASL_ERROR, ASL_MSG_ENTRY_LIST, EndOfFieldList, AslGbl_MsgBuffer);
+        ACPI_FREE (LocalityBuffer);
         return (AE_LIMIT);
     }