mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
plugins: fix ref counting of GstVaapiVideoMemory allocator.
Fix reference counting issue whereby gst_memory_init() does not hold an extra reference to the GstAllocator. So, there could be situations where the last instance of GstVaapiVideoAllocator gets released before a dangling GstVaapiVideoMemory object, thus possibly leading to a crash.
This commit is contained in:
parent
d79d561819
commit
c82a1bc0ff
1 changed files with 2 additions and 1 deletions
|
@ -218,7 +218,7 @@ gst_vaapi_video_memory_new(GstAllocator *base_allocator,
|
|||
return NULL;
|
||||
|
||||
vip = &allocator->image_info;
|
||||
gst_memory_init(&mem->parent_instance, 0, base_allocator, NULL,
|
||||
gst_memory_init(&mem->parent_instance, 0, gst_object_ref(allocator), NULL,
|
||||
GST_VIDEO_INFO_SIZE(vip), 0, 0, GST_VIDEO_INFO_SIZE(vip));
|
||||
|
||||
mem->proxy = NULL;
|
||||
|
@ -239,6 +239,7 @@ gst_vaapi_video_memory_free(GstVaapiVideoMemory *mem)
|
|||
gst_vaapi_object_replace(&mem->surface, NULL);
|
||||
gst_vaapi_object_replace(&mem->image, NULL);
|
||||
gst_vaapi_video_meta_unref(mem->meta);
|
||||
gst_object_unref(GST_MEMORY_CAST(mem)->allocator);
|
||||
g_slice_free(GstVaapiVideoMemory, mem);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue