From 0d9ded403f6e285b6e928c5c850e0481b3a69291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 2 Jun 2020 18:34:57 +0200 Subject: [PATCH] renderer-native: Don't leak DMA buffer CoglFramebuffer When we created the DMA buffer backed CoglFramebuffer, we handed it over to CoglDmaBufHandle which took its own reference. What we failed to do was to release our own reference to it, effectively leaking it. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1283 (cherry picked from commit c823b5ddba18d30e1fdb74d6764cd40637dc4054) --- src/backends/native/meta-renderer-native.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 8d82ad7c4..e94562b28 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -2146,6 +2146,7 @@ meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer, case META_RENDERER_NATIVE_MODE_GBM: { CoglFramebuffer *dmabuf_fb; + CoglDmaBufHandle *dmabuf_handle; struct gbm_bo *new_bo; int dmabuf_fd = -1; @@ -2182,8 +2183,11 @@ meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer, if (!dmabuf_fb) return NULL; - return cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd, new_bo, - (GDestroyNotify) gbm_bo_destroy); + dmabuf_handle = + cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd, new_bo, + (GDestroyNotify) gbm_bo_destroy); + cogl_object_unref (dmabuf_fb); + return dmabuf_handle; } break; #ifdef HAVE_EGL_DEVICE