Revision: 19513
http://sourceforge.net/p/edk2/code/19513
Author: niruiyu
Date: 2015-12-24 06:30:55 +0000 (Thu, 24 Dec 2015)
Log Message:
-----------
Nt32Pkg/WinNtSimpleFileSystemDxe: Fix memory leak
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
Modified Paths:
--------------
trunk/edk2/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c
Modified: trunk/edk2/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c
===================================================================
--- trunk/edk2/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c
2015-12-24 02:31:25 UTC (rev 19512)
+++ trunk/edk2/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c
2015-12-24 06:30:55 UTC (rev 19513)
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD
License
which accompanies this distribution. The full text of the license may be
found at
@@ -628,6 +628,7 @@
StrCat (TempFileName, L"\\*");
PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName,
&PrivateFile->FindBuf);
+ FreePool (TempFileName);
if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {
PrivateFile->IsValidFindBuf = FALSE;
@@ -1188,6 +1189,7 @@
Status = EFI_NOT_FOUND;
}
+ FreePool (TempFileName);
goto Done;
}
@@ -1196,6 +1198,7 @@
//
StrCat (TempFileName, L"\\*");
NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->FindFirstFile
(TempFileName, &NewPrivateFile->FindBuf);
+ FreePool (TempFileName);
if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {
NewPrivateFile->IsValidFindBuf = FALSE;
@@ -1276,12 +1279,14 @@
Status = WinNtSimpleFileSystemGetInfo (&NewPrivateFile->EfiFile,
&gEfiFileInfoGuid, &InfoSize, Info);
if (EFI_ERROR (Status)) {
+ FreePool (Info);
goto Done;
}
Info->Attribute = Attributes;
WinNtSimpleFileSystemSetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid,
InfoSize, Info);
+ FreePool (Info);
}
Done:
@@ -1361,6 +1366,10 @@
FreePool (PrivateFile->FileName);
}
+ if (PrivateFile->FilePath) {
+ FreePool (PrivateFile->FilePath);
+ }
+
FreePool (PrivateFile);
gBS->RestoreTPL (OldTpl);
@@ -1431,6 +1440,7 @@
}
FreePool (PrivateFile->FileName);
+ FreePool (PrivateFile->FilePath);
FreePool (PrivateFile);
gBS->RestoreTPL (OldTpl);
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits