mesa: fix a VBO buffer reference leak in _mesa_bind_vertex_buffer

Fixes: 03ba57c6c5 - mesa: extend _mesa_bind_vertex_buffer to take ownership of the buffer reference

Reviewed-by: Yogesh Mohan Marimuthu <yogesh.mohanmarimuthu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23112>
(cherry picked from commit ce3edf51be)
This commit is contained in:
Marek Olšák 2023-05-18 16:50:50 -04:00 committed by Eric Engestrom
parent c54295e993
commit a8da5a0c0d
2 changed files with 7 additions and 1 deletions

View file

@ -760,7 +760,7 @@
"description": "mesa: fix a VBO buffer reference leak in _mesa_bind_vertex_buffer",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "03ba57c6c53214b19aa0fdb66c680f2cadc3bbd9"
},

View file

@ -304,6 +304,12 @@ _mesa_bind_vertex_buffer(struct gl_context *ctx,
}
vao->NonDefaultStateMask |= BITFIELD_BIT(index);
} else {
/* Since this function owns the vbo reference, it must release it if it
* doesn't use it.
*/
if (take_vbo_ownership)
_mesa_reference_buffer_object(ctx, &vbo, NULL);
}
}