mirror of https://git.ffmpeg.org/ffmpeg.git
avdevice/dshow_capture: Fix error handling in ff_dshow_##prefix##_Create()
Untested, needs review Fixes: CID1591856 Resource leak Fixes: CID1591887 Resource leak Fixes: CID1591874 Resource leak Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
66d6b8033b
commit
348968e9f7
|
@ -124,14 +124,15 @@ void ff_dshow_##prefix##_Destroy(class *this) \
|
||||||
class *ff_dshow_##prefix##_Create(__VA_ARGS__) \
|
class *ff_dshow_##prefix##_Create(__VA_ARGS__) \
|
||||||
{ \
|
{ \
|
||||||
class *this = CoTaskMemAlloc(sizeof(class)); \
|
class *this = CoTaskMemAlloc(sizeof(class)); \
|
||||||
void *vtbl = CoTaskMemAlloc(sizeof(*this->vtbl)); \
|
|
||||||
dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_Create(%p)\n", this); \
|
dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_Create(%p)\n", this); \
|
||||||
if (!this || !vtbl) \
|
if (!this) \
|
||||||
goto fail; \
|
goto fail; \
|
||||||
ZeroMemory(this, sizeof(class)); \
|
ZeroMemory(this, sizeof(class)); \
|
||||||
ZeroMemory(vtbl, sizeof(*this->vtbl)); \
|
this->vtbl = CoTaskMemAlloc(sizeof(*this->vtbl)); \
|
||||||
|
if (!this->vtbl) \
|
||||||
|
goto fail; \
|
||||||
|
ZeroMemory(this->vtbl, sizeof(*this->vtbl)); \
|
||||||
this->ref = 1; \
|
this->ref = 1; \
|
||||||
this->vtbl = vtbl; \
|
|
||||||
if (!setup) \
|
if (!setup) \
|
||||||
goto fail; \
|
goto fail; \
|
||||||
dshowdebug("created ff_dshow_"AV_STRINGIFY(prefix)" %p\n", this); \
|
dshowdebug("created ff_dshow_"AV_STRINGIFY(prefix)" %p\n", this); \
|
||||||
|
|
Loading…
Reference in New Issue