diff mbox

[FFmpeg-devel] avdevice/decklink_enc: do not reference this after freeing it

Message ID 20161210125833.7418-1-cus@passwd.hu
State Accepted
Commit a7946c8964691a8cac8e8c479d61c9b068d9d76e
Headers show

Commit Message

Marton Balint Dec. 10, 2016, 12:58 p.m. UTC
Fixes Coverity CID 1396863.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavdevice/decklink_enc.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marton Balint Dec. 27, 2016, 12:24 a.m. UTC | #1
On Sat, 10 Dec 2016, Marton Balint wrote:

> Fixes Coverity CID 1396863.
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavdevice/decklink_enc.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
> index dc4a24b..ad00224 100644
> --- a/libavdevice/decklink_enc.cpp
> +++ b/libavdevice/decklink_enc.cpp
> @@ -55,7 +55,7 @@ public:
>
>     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
>     virtual ULONG   STDMETHODCALLTYPE AddRef(void)                            { return ++_refs; }
> -    virtual ULONG   STDMETHODCALLTYPE Release(void)                           { if (!--_refs) delete this; return _refs; }
> +    virtual ULONG   STDMETHODCALLTYPE Release(void)                           { if (!--_refs) {delete this; return 0;} return _refs; }
>
>     struct decklink_ctx *_ctx;
>     AVFrame *_avframe;
> --

Applied.

Regards,
Marton
diff mbox

Patch

diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index dc4a24b..ad00224 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -55,7 +55,7 @@  public:
 
     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
     virtual ULONG   STDMETHODCALLTYPE AddRef(void)                            { return ++_refs; }
-    virtual ULONG   STDMETHODCALLTYPE Release(void)                           { if (!--_refs) delete this; return _refs; }
+    virtual ULONG   STDMETHODCALLTYPE Release(void)                           { if (!--_refs) {delete this; return 0;} return _refs; }
 
     struct decklink_ctx *_ctx;
     AVFrame *_avframe;