Michael Stefaniuc : wer: Use FIELD_OFFSET to calculate the size of a struct with variable length array .
Alexandre Julliard
julliard at winehq.org
Wed Jun 13 16:08:33 CDT 2012
Module: wine
Branch: master
Commit: 435ac27d8f51bf296ff10c0fd881eb118283a6b0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=435ac27d8f51bf296ff10c0fd881eb118283a6b0
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Wed Jun 13 10:39:52 2012 +0200
wer: Use FIELD_OFFSET to calculate the size of a struct with variable length array.
---
dlls/wer/main.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/dlls/wer/main.c b/dlls/wer/main.c
index ae9ab26..78943eb 100644
--- a/dlls/wer/main.c
+++ b/dlls/wer/main.c
@@ -261,7 +261,6 @@ HRESULT WINAPI WerReportCloseHandle(HREPORT hreport)
HRESULT WINAPI WerReportCreate(PCWSTR eventtype, WER_REPORT_TYPE reporttype, PWER_REPORT_INFORMATION reportinfo, HREPORT *phandle)
{
report_t *report;
- DWORD len;
TRACE("(%s, %d, %p, %p)\n", debugstr_w(eventtype), reporttype, reportinfo, phandle);
if (reportinfo) {
@@ -274,9 +273,7 @@ HRESULT WINAPI WerReportCreate(PCWSTR eventtype, WER_REPORT_TYPE reporttype, PWE
return E_INVALIDARG;
}
- len = lstrlenW(eventtype) + 1;
-
- report = heap_alloc_zero(len * sizeof(WCHAR) + sizeof(report_t));
+ report = heap_alloc_zero(FIELD_OFFSET(report_t, eventtype[lstrlenW(eventtype) + 1]));
if (!report)
return __HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
More information about the wine-cvs
mailing list