[vlc-devel] [PATCH] nvdec: avoid crash when nvdec context fails to initialize

Pierre Lamot pierre at videolabs.io
Fri Oct 4 11:09:27 CEST 2019


  GetNVDECOpaqueDevice used in DecoderContextClose expects the
  device type to be set to VLC_DECODER_DEVICE_NVDEC
---
 modules/hw/nvdec/nvdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index 4040c08ae8..b13152456d 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -952,6 +952,8 @@ DecoderContextOpen(vlc_decoder_device *device, vout_window_t *window)
     if (unlikely(p_sys == NULL))
         return VLC_ENOMEM;
     device->opaque = p_sys;
+    device->ops = &dev_ops;
+    device->type = VLC_DECODER_DEVICE_NVDEC;
     p_sys->cudaFunctions = NULL;
 
     int result = cuda_load_functions(&p_sys->cudaFunctions, device);
@@ -973,8 +975,6 @@ DecoderContextOpen(vlc_decoder_device *device, vout_window_t *window)
         return result;
     }
 
-    device->ops = &dev_ops;
-    device->type = VLC_DECODER_DEVICE_NVDEC;
     return VLC_SUCCESS;
 }
 
-- 
2.20.1



More information about the vlc-devel mailing list