[PATCH 1/2] shell32: Allocate returned array in IKnownFolderManager::GetFolderIds

Andrew Eikum aeikum at codeweavers.com
Wed Apr 8 10:59:33 CDT 2015


This is a user-freed array, so we don't want to return our internal
memory.

---
 dlls/shell32/shellpath.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index d853274..731ea2f 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -4178,7 +4178,8 @@ static HRESULT WINAPI foldermanager_GetFolderIds(
 
     TRACE("%p, %p\n", ppKFId, pCount);
 
-    *ppKFId = fm->ids;
+    *ppKFId = CoTaskMemAlloc(fm->num_ids * sizeof(KNOWNFOLDERID));
+    memcpy(*ppKFId, fm->ids, fm->num_ids * sizeof(KNOWNFOLDERID));
     *pCount = fm->num_ids;
     return S_OK;
 }
-- 
2.3.5





More information about the wine-patches mailing list