screen-cast/src: Always first set spa buffer data to NULL

We use that elsewhere for sanity checking, and it's not initialized to
anything, so might be pointing to invalid memory if buffer allocation
failed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1697>
This commit is contained in:
Jonas Ådahl 2021-02-01 18:32:33 +01:00 committed by Marge Bot
parent 08ad107df5
commit ca95ccdef0

View File

@ -745,6 +745,7 @@ on_stream_add_buffer (void *data,
spa_data[0].mapoffset = 0; spa_data[0].mapoffset = 0;
spa_data[0].maxsize = stride * priv->video_format.size.height; spa_data[0].maxsize = stride * priv->video_format.size.height;
spa_data[0].data = NULL;
dmabuf_handle = dmabuf_handle =
meta_screen_cast_create_dma_buf_handle (screen_cast, meta_screen_cast_create_dma_buf_handle (screen_cast,
@ -756,7 +757,6 @@ on_stream_add_buffer (void *data,
spa_data[0].type = SPA_DATA_DmaBuf; spa_data[0].type = SPA_DATA_DmaBuf;
spa_data[0].flags = SPA_DATA_FLAG_READWRITE; spa_data[0].flags = SPA_DATA_FLAG_READWRITE;
spa_data[0].fd = cogl_dma_buf_handle_get_fd (dmabuf_handle); spa_data[0].fd = cogl_dma_buf_handle_get_fd (dmabuf_handle);
spa_data[0].data = NULL;
g_hash_table_insert (priv->dmabuf_handles, g_hash_table_insert (priv->dmabuf_handles,
GINT_TO_POINTER (spa_data[0].fd), GINT_TO_POINTER (spa_data[0].fd),