Michael Stefaniuc : qedit: Use offsetof for the size of a struct with a varlen array.

Alexandre Julliard julliard at winehq.org
Wed Feb 5 13:18:52 CST 2014


Module: wine
Branch: master
Commit: d436ea9597e7d8578570c8d2a3db0d40a98e5af0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d436ea9597e7d8578570c8d2a3db0d40a98e5af0

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Wed Feb  5 00:22:53 2014 +0100

qedit: Use offsetof for the size of a struct with a varlen array.

---

 dlls/qedit/samplegrabber.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c
index d4c9ddd..15a3471 100644
--- a/dlls/qedit/samplegrabber.c
+++ b/dlls/qedit/samplegrabber.c
@@ -46,7 +46,7 @@ typedef struct _PE_Impl {
     LONG refCount;
     ULONG numPins;
     ULONG index;
-    IPin *pins[0];
+    IPin *pins[1];
 } PE_Impl;
 
 
@@ -174,7 +174,7 @@ static const IEnumPinsVtbl IEnumPins_VTable =
 static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount)
 {
     PE_Impl *obj;
-    ULONG len = sizeof(PE_Impl) + (pinCount * sizeof(IPin *));
+    ULONG len = offsetof(PE_Impl, pins[pinCount]);
     ULONG i;
 
     obj = CoTaskMemAlloc(len);




More information about the wine-cvs mailing list