summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorLuis de Bethencourt <luis@debethencourt.com>2015-08-05 11:39:01 +0100
committerLuis de Bethencourt <luis@debethencourt.com>2015-08-05 11:39:03 +0100
commitcc8af753b9721e6acad17a1f6219616709b8303f (patch)
tree34bcb8f11561b3b543dc3f55f243e1bb613812ac /ext
parentca52600ccbeb05d928212c07552795741de09b82 (diff)
downloadgstreamer-plugins-bad-cc8af753b9721e6acad17a1f6219616709b8303f.tar.gz
opencv: facedetect: check pointer before using it
Check if profile is NULL before dereferencing it with new. Also, new will never return NULL; if allocation fails, a std::bad_alloc exception will be thrown instead. Remove check for a NULL return. CID #1315258
Diffstat (limited to 'ext')
-rw-r--r--ext/opencv/gstfacedetect.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/ext/opencv/gstfacedetect.cpp b/ext/opencv/gstfacedetect.cpp
index 392846b9f..12c6f4cfa 100644
--- a/ext/opencv/gstfacedetect.cpp
+++ b/ext/opencv/gstfacedetect.cpp
@@ -803,14 +803,12 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
static CascadeClassifier *
gst_face_detect_load_profile (GstFaceDetect * filter, gchar * profile)
{
- CascadeClassifier *cascade = new CascadeClassifier (profile);
+ CascadeClassifier *cascade;
if (profile == NULL)
- return NULL;
- if (!cascade) {
- GST_WARNING_OBJECT (filter, "Couldn't load Haar classifier cascade: %s.",
- profile);
- }
+ return NULL;
+
+ cascade = new CascadeClassifier (profile);
return cascade;
}