decklinkvideosrc: fix use-after-free in error code path

This commit is contained in:
Tim-Philipp Müller 2016-05-10 09:40:38 +01:00
parent 8d128f8bf5
commit ddcc1c6442

View file

@ -567,10 +567,10 @@ gst_decklink_video_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
self->caps_mode = f->mode; self->caps_mode = f->mode;
} else { } else {
g_mutex_unlock (&self->lock); g_mutex_unlock (&self->lock);
capture_frame_free (f);
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION, GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,
("Invalid mode in captured frame"), ("Invalid mode in captured frame"),
("Mode set to %d but captured %d", self->caps_mode, f->mode)); ("Mode set to %d but captured %d", self->caps_mode, f->mode));
capture_frame_free (f);
return GST_FLOW_NOT_NEGOTIATED; return GST_FLOW_NOT_NEGOTIATED;
} }
} }
@ -582,10 +582,10 @@ gst_decklink_video_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
self->caps_format = f->format; self->caps_format = f->format;
} else { } else {
g_mutex_unlock (&self->lock); g_mutex_unlock (&self->lock);
capture_frame_free (f);
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION, GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,
("Invalid pixel format in captured frame"), ("Invalid pixel format in captured frame"),
("Format set to %d but captured %d", self->caps_format, f->format)); ("Format set to %d but captured %d", self->caps_format, f->format));
capture_frame_free (f);
return GST_FLOW_NOT_NEGOTIATED; return GST_FLOW_NOT_NEGOTIATED;
} }
} }