mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-09 05:58:22 +02:00
gl-renderer: Fix possible memory leak when no dmabuf modifers are supported
Some drivers support EGL_EXT_image_dma_buf_import_modifiers for format enumeration, but don't have any modifiers. In this case, on platforms where malloc(0) returns non-NULL, we would leak that allocation to the caller. Handle this by noticing when the number of supported modifiers is 0 and returning early.
This commit is contained in:
parent
95efe82982
commit
570490cef5
1 changed files with 2 additions and 1 deletions
|
|
@ -2424,7 +2424,8 @@ gl_renderer_query_dmabuf_modifiers(struct weston_compositor *wc, int format,
|
|||
|
||||
if (!gr->has_dmabuf_import_modifiers ||
|
||||
!gr->query_dmabuf_modifiers(gr->egl_display, format, 0, NULL,
|
||||
NULL, &num)) {
|
||||
NULL, &num) ||
|
||||
num == 0) {
|
||||
*num_modifiers = 0;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue