[edk2-devel] [edk2-platforms][PATCH v4 12/12] Ext4Pkg: Corrects memory leak in Ext4ReadSlowSymlink

Savva Mitrofanov posted 12 patches 3 years ago
[edk2-devel] [edk2-platforms][PATCH v4 12/12] Ext4Pkg: Corrects memory leak in Ext4ReadSlowSymlink
Posted by Savva Mitrofanov 3 years ago
We need to free SymlinkTmp before exiting if SymlinkSizeTmp != ReadSize
condition is true

Reported-by: Marvin Häuser <mhaeuser@posteo.de>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Fixes: e81432fbacb7 ("Ext4Pkg: Add symbolic links support")
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>
---
 Features/Ext4Pkg/Ext4Dxe/Symlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Features/Ext4Pkg/Ext4Dxe/Symlink.c b/Features/Ext4Pkg/Ext4Dxe/Symlink.c
index 8b1511a38b55..1189a99ded2b 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Symlink.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Symlink.c
@@ -160,6 +160,7 @@ Ext4ReadSlowSymlink (
       DEBUG_FS,

       "[ext4] Error! The size of the read block doesn't match the value from the inode!\n"

       ));

+    FreePool (SymlinkTmp);

     return EFI_VOLUME_CORRUPTED;

   }

 

-- 
2.39.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99458): https://edk2.groups.io/g/devel/message/99458
Mute This Topic: https://groups.io/mt/96697377/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-platforms][PATCH v4 12/12] Ext4Pkg: Corrects memory leak in Ext4ReadSlowSymlink
Posted by Marvin Häuser 3 years ago
Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>

> On 2. Feb 2023, at 11:21, Savva Mitrofanov <savvamtr@gmail.com> wrote:
> 
> We need to free SymlinkTmp before exiting if SymlinkSizeTmp != ReadSize
> condition is true
> 
> Reported-by: Marvin Häuser <mhaeuser@posteo.de>
> Cc: Pedro Falcato <pedro.falcato@gmail.com>
> Cc: Vitaly Cheptsov <vit9696@protonmail.com>
> Fixes: e81432fbacb7 ("Ext4Pkg: Add symbolic links support")
> Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
> Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>
> ---
> Features/Ext4Pkg/Ext4Dxe/Symlink.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/Features/Ext4Pkg/Ext4Dxe/Symlink.c b/Features/Ext4Pkg/Ext4Dxe/Symlink.c
> index 8b1511a38b55..1189a99ded2b 100644
> --- a/Features/Ext4Pkg/Ext4Dxe/Symlink.c
> +++ b/Features/Ext4Pkg/Ext4Dxe/Symlink.c
> @@ -160,6 +160,7 @@ Ext4ReadSlowSymlink (
>       DEBUG_FS,
>       "[ext4] Error! The size of the read block doesn't match the value from the inode!\n"
>       ));
> +    FreePool (SymlinkTmp);
>     return EFI_VOLUME_CORRUPTED;
>   }
> 
> -- 
> 2.39.1
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99459): https://edk2.groups.io/g/devel/message/99459
Mute This Topic: https://groups.io/mt/96697377/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-