vlc | branch: master | Pierre Lamot <[email protected]> | Fri Oct  4 11:09:27 
2019 +0200| [b96764b139be4d829339acd08052662464eacbb8] | committer: Steve Lhomme

nvdec: avoid crash when nvdec context fails to initialize

GetNVDECOpaqueDevice used in DecoderContextClose expects the
  device type to be set to VLC_DECODER_DEVICE_NVDEC

Signed-off-by: Steve Lhomme <[email protected]>

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

 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;
 }
 

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to