[PATCH 2/2] kernel32/profile: Fix initialization of PROFILESECTION::name.
Carlos Rivera
carlos at superkaos.org
Sat Sep 12 09:52:08 CDT 2020
By default it is initialized to NULL.
If a section is found while parsing the ini file, even if it is just "[]" then allocate
memory and set the appropiate string.
This allows to distinguish the case where the section is "[]" from the case where there is
no section at all.
Signed-off-by: Carlos Rivera <carlos at superkaos.org>
---
This makes a test case pass in Wine.
---
dlls/kernel32/profile.c | 2 +-
dlls/kernel32/tests/profile.c | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
index 8bc7533599..8b33c6f400 100644
--- a/dlls/kernel32/profile.c
+++ b/dlls/kernel32/profile.c
@@ -85,7 +85,7 @@ static PROFILESECTION *new_PROFILESECTION(const WCHAR *name, int len)
section->next = NULL;
section->name = NULL;
- if (name && len > 0)
+ if (name)
{
if (!(section->name = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR))))
{
diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
index f981558548..05822e77af 100644
--- a/dlls/kernel32/tests/profile.c
+++ b/dlls/kernel32/tests/profile.c
@@ -152,9 +152,7 @@ static void test_profile_string(void)
/* works only in unicode, ascii crashes */
ret=GetPrivateProfileStringW(emptyW, keyW, emptyW, bufW, ARRAY_SIZE(bufW), TESTFILE2W);
- todo_wine
ok(ret == 13, "expected 13, got %u\n", ret);
- todo_wine
ok(!lstrcmpW(valsectionW,bufW), "expected %s, got %s\n",
wine_dbgstr_w(valsectionW), wine_dbgstr_w(bufW) );
--
2.28.0
More information about the wine-devel
mailing list