msdk: Close fd handle
authorXiang, Haihao <haihao.xiang@intel.com>
Tue, 20 Nov 2018 06:21:54 +0000 (14:21 +0800)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Mon, 26 Nov 2018 16:13:44 +0000 (16:13 +0000)
Otherwise it will result in resource leak if mem == NULL

sys/msdk/gstmsdkvideomemory.c

index b9b4f9c..2648468 100644 (file)
@@ -415,6 +415,7 @@ gst_msdk_dmabuf_memory_new_with_surface (GstAllocator * allocator,
   mem = gst_dmabuf_allocator_alloc (allocator, fd, size);
   if (!mem) {
     GST_ERROR ("failed ! dmabuf fd: %d", fd);
+    close (fd);
     return NULL;
   }