[vlc-devel] [PATCH] decoder_helpers: clean decoder device objres on failure
Alexandre Janniaux
ajanni at videolabs.io
Wed Dec 23 09:53:53 UTC 2020
objres are used by nvdec when opening the decoder device so clean them
on failure to avoid a leak.
---
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 *
--
2.29.2
More information about the vlc-devel
mailing list