Module: wine Branch: master Commit: b791c25274b83bc9083359f74a53d6cbd637d575 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b791c25274b83bc9083359f74a...
Author: Michael Stefaniuc mstefani@redhat.de Date: Mon Nov 12 10:43:44 2012 +0100
msiexec: Use FIELD_OFFSET to calculate the size of a struct with variable length array.
---
programs/msiexec/msiexec.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/programs/msiexec/msiexec.c b/programs/msiexec/msiexec.c index 2227af0..9b378c6 100644 --- a/programs/msiexec/msiexec.c +++ b/programs/msiexec/msiexec.c @@ -109,10 +109,8 @@ static BOOL IsProductCode(LPWSTR str) static VOID StringListAppend(struct string_list **list, LPCWSTR str) { struct string_list *entry; - DWORD size;
- size = sizeof *entry + lstrlenW(str) * sizeof (WCHAR); - entry = HeapAlloc(GetProcessHeap(), 0, size); + entry = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(struct string_list, str[lstrlenW(str) + 1])); if(!entry) { WINE_ERR("Out of memory!\n");