From 36231bb60d685aa3f452f163edc44d03977dcb24 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Thu, 1 Feb 2018 01:31:14 -0800 Subject: [PATCH] Fixing potential segfault referencing cuda_cascade This resolves a potential segfault encounted at line 76 where cuda_cascade is an invalid value. --- src/openalpr/detection/detectorcuda.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openalpr/detection/detectorcuda.cpp b/src/openalpr/detection/detectorcuda.cpp index 5ba1c94..1818e1c 100644 --- a/src/openalpr/detection/detectorcuda.cpp +++ b/src/openalpr/detection/detectorcuda.cpp @@ -34,7 +34,8 @@ namespace alpr #if OPENCV_MAJOR_VERSION == 2 if( this->cuda_cascade.load( get_detector_file() ) ) #else - if( this->cuda_cascade->create( get_detector_file() ) ) + cuda_cascade = cuda::CascadeClassifier::create(get_detector_file()); + if( !this->cuda_cascade.get()->empty() ) #endif { this->loaded = true;