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