summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-07-12 17:14:49 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-07-12 17:14:49 +0200
commitc82a1bc0ff4339a150cf4e8f8075d51ba49c50f8 (patch)
tree71174e9581a3b2bad7a1e048b4b4ae631aea0467
parentd79d561819277cc24818a3106080258d32755c89 (diff)
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.
-rw-r--r--gst/vaapi/gstvaapivideomemory.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gst/vaapi/gstvaapivideomemory.c b/gst/vaapi/gstvaapivideomemory.c
index 54090681..29bc2a9b 100644
--- a/gst/vaapi/gstvaapivideomemory.c
+++ b/gst/vaapi/gstvaapivideomemory.c
@@ -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);
}