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

Pierre Lamot git at videolan.org
Fri Oct 4 15:05:42 CEST 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | 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 <robux4 at ycbcr.xyz>

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



More information about the vlc-commits mailing list