mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-07-03 13:16:04 +00:00
glupload: fix segfault
Without this fix, it is possible that outbuf is not initialized, which will result in segfault when call gst_buffer_replace (&outbuf, NULL). In addition, the patch fixes potential memory leak in restart path. The segfault can be reproduced by the pipeline below: GST_GL_PLATFORM=egl \ gst-launch-1.0 videotestsrc ! msdkh265enc ! msdkh265dec ! \ 'video/x-raw(memory:DMABuf)' ! glimagesink
This commit is contained in:
parent
1db94e5205
commit
5b11ac0819
|
@ -2024,7 +2024,7 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
|
||||||
GstBuffer ** outbuf_ptr)
|
GstBuffer ** outbuf_ptr)
|
||||||
{
|
{
|
||||||
GstGLUploadReturn ret = GST_GL_UPLOAD_ERROR;
|
GstGLUploadReturn ret = GST_GL_UPLOAD_ERROR;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf = NULL;
|
||||||
gpointer last_impl = upload->priv->method_impl;
|
gpointer last_impl = upload->priv->method_impl;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_GL_UPLOAD (upload), FALSE);
|
g_return_val_if_fail (GST_IS_GL_UPLOAD (upload), FALSE);
|
||||||
|
@ -2065,6 +2065,8 @@ restart:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_buffer_replace (&outbuf, NULL);
|
||||||
goto restart;
|
goto restart;
|
||||||
} else if (ret == GST_GL_UPLOAD_DONE || ret == GST_GL_UPLOAD_RECONFIGURE) {
|
} else if (ret == GST_GL_UPLOAD_DONE || ret == GST_GL_UPLOAD_RECONFIGURE) {
|
||||||
if (last_impl != upload->priv->method_impl) {
|
if (last_impl != upload->priv->method_impl) {
|
||||||
|
@ -2079,6 +2081,7 @@ restart:
|
||||||
/* we are done */
|
/* we are done */
|
||||||
} else {
|
} else {
|
||||||
upload->priv->method_impl = NULL;
|
upload->priv->method_impl = NULL;
|
||||||
|
gst_buffer_replace (&outbuf, NULL);
|
||||||
NEXT_METHOD;
|
NEXT_METHOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue