mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 05:16:05 +00:00
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
This commit is contained in:
parent
ca52600ccb
commit
cc8af753b9
1 changed files with 4 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
cascade = new CascadeClassifier (profile);
|
||||
return cascade;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue