kms: drop use of GSlice allocator and remove unnecessary check

g_new0() will never return NULL but just abort if it can't
allocate memory (same for g_slice_new).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3784>
This commit is contained in:
Tim-Philipp Müller 2023-01-25 01:13:27 +00:00 committed by GStreamer Marge Bot
parent 35405de344
commit 85476eab08

View file

@ -234,7 +234,7 @@ gst_kms_allocator_free (GstAllocator * allocator, GstMemory * mem)
kmsmem = (GstKMSMemory *) mem;
gst_kms_allocator_memory_reset (alloc, kmsmem);
g_slice_free (GstKMSMemory, kmsmem);
g_free (kmsmem);
}
static void
@ -460,16 +460,14 @@ gst_kms_allocator_bo_alloc (GstAllocator * allocator, GstVideoInfo * vinfo)
GstKMSMemory *kmsmem;
GstMemory *mem;
kmsmem = g_slice_new0 (GstKMSMemory);
if (!kmsmem)
return NULL;
kmsmem = g_new0 (GstKMSMemory, 1);
alloc = GST_KMS_ALLOCATOR (allocator);
mem = GST_MEMORY_CAST (kmsmem);
if (!gst_kms_allocator_memory_create (alloc, kmsmem, vinfo)) {
g_slice_free (GstKMSMemory, kmsmem);
g_free (kmsmem);
return NULL;
}
@ -498,9 +496,7 @@ gst_kms_allocator_dmabuf_import (GstAllocator * allocator, gint * prime_fds,
g_return_val_if_fail (n_planes <= GST_VIDEO_MAX_PLANES, FALSE);
kmsmem = g_slice_new0 (GstKMSMemory);
if (!kmsmem)
return FALSE;
kmsmem = g_new0 (GstKMSMemory, 1);
mem = GST_MEMORY_CAST (kmsmem);
gst_memory_init (mem, GST_MEMORY_FLAG_NO_SHARE, allocator, NULL,