[edk2-devel] [PATCH] UnitTestFrameworkPkg/PersistenceLib: Correct the allocated size.

Guomin Jiang posted 1 patch 4 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20200331030536.1559-1-guomin.jiang@intel.com
.../UnitTestPersistenceLibSimpleFileSystem.c                    | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel] [PATCH] UnitTestFrameworkPkg/PersistenceLib: Correct the allocated size.
Posted by Guomin Jiang 4 years ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2608

According to logic and the practice, it is need to allocate ascii length
by 2 for unicode string.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
---
 .../UnitTestPersistenceLibSimpleFileSystem.c                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.c b/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.c
index ccca9bfacb..6da85c459d 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.c
@@ -67,7 +67,7 @@ GetCacheFileDevicePath (
   // Before we can start, change test name from ASCII to Unicode.
   //
   CacheFilePathLength = AsciiStrLen (Framework->ShortTitle) + 1;
-  TestName = AllocatePool (CacheFilePathLength);
+  TestName = AllocatePool (CacheFilePathLength * sizeof(CHAR16));
   if (!TestName) {
     goto Exit;
   }
-- 
2.25.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56714): https://edk2.groups.io/g/devel/message/56714
Mute This Topic: https://groups.io/mt/72670002/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-