mirror of https://github.com/acidanthera/audk.git
Nt32Pkg/WinNtSimpleFileSystemDxe: Fix memory leak
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19513 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
62ba2d57ba
commit
521465d218
|
@ -1,6 +1,6 @@
|
||||||
/**@file
|
/**@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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -628,6 +628,7 @@ Returns:
|
||||||
StrCat (TempFileName, L"\\*");
|
StrCat (TempFileName, L"\\*");
|
||||||
|
|
||||||
PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName, &PrivateFile->FindBuf);
|
PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName, &PrivateFile->FindBuf);
|
||||||
|
FreePool (TempFileName);
|
||||||
|
|
||||||
if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {
|
if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {
|
||||||
PrivateFile->IsValidFindBuf = FALSE;
|
PrivateFile->IsValidFindBuf = FALSE;
|
||||||
|
@ -1188,6 +1189,7 @@ Returns:
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FreePool (TempFileName);
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1196,6 +1198,7 @@ Returns:
|
||||||
//
|
//
|
||||||
StrCat (TempFileName, L"\\*");
|
StrCat (TempFileName, L"\\*");
|
||||||
NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->FindFirstFile (TempFileName, &NewPrivateFile->FindBuf);
|
NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->FindFirstFile (TempFileName, &NewPrivateFile->FindBuf);
|
||||||
|
FreePool (TempFileName);
|
||||||
|
|
||||||
if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {
|
if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {
|
||||||
NewPrivateFile->IsValidFindBuf = FALSE;
|
NewPrivateFile->IsValidFindBuf = FALSE;
|
||||||
|
@ -1276,12 +1279,14 @@ Returns:
|
||||||
Status = WinNtSimpleFileSystemGetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, &InfoSize, Info);
|
Status = WinNtSimpleFileSystemGetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, &InfoSize, Info);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
FreePool (Info);
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info->Attribute = Attributes;
|
Info->Attribute = Attributes;
|
||||||
|
|
||||||
WinNtSimpleFileSystemSetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, InfoSize, Info);
|
WinNtSimpleFileSystemSetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, InfoSize, Info);
|
||||||
|
FreePool (Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
|
@ -1361,6 +1366,10 @@ Returns:
|
||||||
FreePool (PrivateFile->FileName);
|
FreePool (PrivateFile->FileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PrivateFile->FilePath) {
|
||||||
|
FreePool (PrivateFile->FilePath);
|
||||||
|
}
|
||||||
|
|
||||||
FreePool (PrivateFile);
|
FreePool (PrivateFile);
|
||||||
|
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
@ -1431,6 +1440,7 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (PrivateFile->FileName);
|
FreePool (PrivateFile->FileName);
|
||||||
|
FreePool (PrivateFile->FilePath);
|
||||||
FreePool (PrivateFile);
|
FreePool (PrivateFile);
|
||||||
|
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
Loading…
Reference in New Issue