qedit: Don't dereference NULL on alloc failure.

This commit is contained in:
Michael Stefaniuc 2014-02-05 00:20:22 +01:00 committed by Alexandre Julliard
parent 8612c266db
commit 183bd439fa
1 changed files with 17 additions and 13 deletions

View File

@ -173,10 +173,14 @@ static const IEnumPinsVtbl IEnumPins_VTable =
static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount) static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount)
{ {
PE_Impl *obj;
ULONG len = sizeof(PE_Impl) + (pinCount * sizeof(IPin *)); ULONG len = sizeof(PE_Impl) + (pinCount * sizeof(IPin *));
PE_Impl *obj = CoTaskMemAlloc(len);
if (obj) {
ULONG i; ULONG i;
obj = CoTaskMemAlloc(len);
if (!obj)
return NULL;
ZeroMemory(obj, len); ZeroMemory(obj, len);
obj->pe.lpVtbl = &IEnumPins_VTable; obj->pe.lpVtbl = &IEnumPins_VTable;
obj->refCount = 1; obj->refCount = 1;
@ -186,7 +190,7 @@ static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCou
for (i = 0; i < pinCount; i++) for (i = 0; i < pinCount; i++)
obj->pins[i] = pins[i]; obj->pins[i] = pins[i];
IBaseFilter_AddRef(filter); IBaseFilter_AddRef(filter);
}
return &obj->pe; return &obj->pe;
} }