[FFmpeg-cvslog] avdevice/dshow_capture: Fix error handling in ff_dshow_##prefix##_Create()
Michael Niedermayer
git at videolan.org
Mon Jul 15 03:01:59 EEST 2024
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Jul 7 20:47:27 2024 +0200| [348968e9f7d8abb743a5dfca8e522ae0cf1ddc8b] | committer: Michael Niedermayer
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 at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=348968e9f7d8abb743a5dfca8e522ae0cf1ddc8b
---
libavdevice/dshow_capture.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index 81e684b9be..bb39d4947a 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -124,14 +124,15 @@ void ff_dshow_##prefix##_Destroy(class *this) \
class *ff_dshow_##prefix##_Create(__VA_ARGS__) \
{ \
class *this = CoTaskMemAlloc(sizeof(class)); \
- void *vtbl = CoTaskMemAlloc(sizeof(*this->vtbl)); \
dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_Create(%p)\n", this); \
- if (!this || !vtbl) \
+ if (!this) \
goto fail; \
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->vtbl = vtbl; \
if (!setup) \
goto fail; \
dshowdebug("created ff_dshow_"AV_STRINGIFY(prefix)" %p\n", this); \
More information about the ffmpeg-cvslog
mailing list