From af97e98315fc7063c9e116c7af0df450ce0a5afc Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 12 Jan 2023 22:17:24 +0900 Subject: [PATCH] d3d11memory: Fix potential crash in GstD3D11PoolAllocator Allocator object can be the final refcount holder, when a GstD3D11Memory is being released. Do unref allocator once there's no more remaining operation. Part-of: --- .../gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp index 917eac7cb5..9bcc9104c3 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/d3d11/gstd3d11memory.cpp @@ -1826,12 +1826,13 @@ gst_d3d11_pool_allocator_release_memory (GstD3D11PoolAllocator * self, GST_MINI_OBJECT_CAST (mem)->dispose = NULL; mem->allocator = (GstAllocator *) gst_object_ref (_d3d11_memory_allocator); - gst_object_unref (self); /* keep it around in our queue */ gst_atomic_queue_push (self->priv->queue, mem); gst_poll_write_control (self->priv->poll); dec_outstanding (self); + + gst_object_unref (self); } static gboolean