[vlc-commits] decoder_helpers: clean decoder device objres on failure

Alexandre Janniaux git at videolan.org
Sun Jan 3 15:14:48 UTC 2021


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Wed Dec 23 10:53:53 2020 +0100| [81729b987e479626f8d91bf173ae03864314c7b4] | committer: Alexandre Janniaux

decoder_helpers: clean decoder device objres on failure

objres are used by nvdec when opening the decoder device so clean them
on failure to avoid a leak.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=81729b987e479626f8d91bf173ae03864314c7b4
---

 src/input/decoder_helpers.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index c98e62bf21..9efd121888 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -171,7 +171,10 @@ static int decoder_device_Open(void *func, bool forced, va_list ap)
     vlc_decoder_device_Open open = func;
     vlc_decoder_device *device = va_arg(ap, vlc_decoder_device *);
     vout_window_t *window = va_arg(ap, vout_window_t *);
-    return open(device, window);
+    int ret = open(device, window);
+    if (ret != VLC_SUCCESS)
+        vlc_objres_clear(&device->obj);
+    return ret;
 }
 
 vlc_decoder_device *



More information about the vlc-commits mailing list