Module: wine Branch: master Commit: 183bd439fa18053dc6f96e224d33817090dcffd9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=183bd439fa18053dc6f96e224d...
Author: Michael Stefaniuc mstefani@redhat.de Date: Wed Feb 5 00:20:22 2014 +0100
qedit: Don't dereference NULL on alloc failure.
---
dlls/qedit/samplegrabber.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index d2523a8..d4c9ddd 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -173,20 +173,24 @@ 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 *)); - PE_Impl *obj = CoTaskMemAlloc(len); - if (obj) { - ULONG i; - ZeroMemory(obj, len); - obj->pe.lpVtbl = &IEnumPins_VTable; - obj->refCount = 1; - obj->filter = filter; - obj->numPins = pinCount; - obj->index = 0; - for (i=0; i<pinCount; i++) - obj->pins[i] = pins[i]; - IBaseFilter_AddRef(filter); - } + ULONG i; + + obj = CoTaskMemAlloc(len); + if (!obj) + return NULL; + + ZeroMemory(obj, len); + obj->pe.lpVtbl = &IEnumPins_VTable; + obj->refCount = 1; + obj->filter = filter; + obj->numPins = pinCount; + obj->index = 0; + for (i = 0; i < pinCount; i++) + obj->pins[i] = pins[i]; + IBaseFilter_AddRef(filter); + return &obj->pe; }