mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
omx: Set pAppPrivate of buffers to NULL when deallocating buffers
This prevents usage of freed memory later if the OMX component has weird behaviour.
This commit is contained in:
parent
2ea5bdf553
commit
8fd4eaae69
1 changed files with 21 additions and 4 deletions
25
omx/gstomx.c
25
omx/gstomx.c
|
@ -312,8 +312,16 @@ EmptyBufferDone (OMX_HANDLETYPE hComponent, OMX_PTR pAppData,
|
|||
OMX_BUFFERHEADERTYPE * pBuffer)
|
||||
{
|
||||
GstOMXBuffer *buf = pBuffer->pAppPrivate;
|
||||
GstOMXPort *port = buf->port;
|
||||
GstOMXComponent *comp = port->comp;
|
||||
GstOMXPort *port;
|
||||
GstOMXComponent *comp;
|
||||
|
||||
if (buf == NULL) {
|
||||
GST_ERROR ("Have unknown or deallocated buffer %p", pBuffer);
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
port = buf->port;
|
||||
comp = port->comp;
|
||||
|
||||
g_assert (buf->omx_buf == pBuffer);
|
||||
|
||||
|
@ -335,8 +343,16 @@ FillBufferDone (OMX_HANDLETYPE hComponent, OMX_PTR pAppData,
|
|||
OMX_BUFFERHEADERTYPE * pBuffer)
|
||||
{
|
||||
GstOMXBuffer *buf = pBuffer->pAppPrivate;
|
||||
GstOMXPort *port = buf->port;
|
||||
GstOMXComponent *comp = port->comp;
|
||||
GstOMXPort *port;
|
||||
GstOMXComponent *comp;
|
||||
|
||||
if (buf == NULL) {
|
||||
GST_ERROR ("Have unknown or deallocated buffer %p", pBuffer);
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
port = buf->port;
|
||||
comp = port->comp;
|
||||
|
||||
g_assert (buf->omx_buf == pBuffer);
|
||||
|
||||
|
@ -1344,6 +1360,7 @@ gst_omx_port_deallocate_buffers_unlocked (GstOMXPort * port)
|
|||
*/
|
||||
if (buf->omx_buf) {
|
||||
g_assert (buf == buf->omx_buf->pAppPrivate);
|
||||
buf->omx_buf->pAppPrivate = NULL;
|
||||
tmp = OMX_FreeBuffer (comp->handle, port->index, buf->omx_buf);
|
||||
if (tmp != OMX_ErrorNone) {
|
||||
GST_ERROR_OBJECT (comp->parent,
|
||||
|
|
Loading…
Reference in a new issue