mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 08:50:09 +01:00
virgl: fix member access to a NULL pointer struct
This fixes VirglStagingMgr tests that tries to access a struct member of a structure that is NULL. This has been detected using Undefined Behaviour Sanitizer. ``` Running main() from ../src/gtest/src/gtest_main.cc [==========] Running 9 tests from 2 test suites. [----------] Global test environment set-up. [----------] 7 tests from VirglStagingMgr [ RUN ] VirglStagingMgr.non_fitting_allocation_reallocates_resource stderr: ../src/gallium/drivers/virgl/tests/virgl_staging_mgr_test.cpp:72:22: runtime error: member access within null pointer of type 'struct virgl_hw_res' ``` Reviewed-by: Eric Engestrom <eric@igalia.com> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30880>
This commit is contained in:
parent
e54a15f700
commit
6aafb58432
1 changed files with 2 additions and 1 deletions
|
|
@ -69,7 +69,8 @@ fake_resource_reference(struct virgl_winsys *vws,
|
|||
{
|
||||
struct virgl_hw_res *old = *dres;
|
||||
|
||||
if (pipe_reference(&(*dres)->reference, &sres->reference)) {
|
||||
if (pipe_reference(old ? &old->reference : NULL,
|
||||
sres ? &sres->reference : NULL)) {
|
||||
FREE(old->data);
|
||||
FREE(old);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue