mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 04:30:10 +01:00
nvk: Fix segfault when opening DRI device file returns error
Previously, ver was unitialized on this path, causing UB on the `if (ver)` branch after the out_err label. Signed-off-by: Benjamin Lee <benjamin@computer.surgery> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
parent
3572f5cd7e
commit
354fe8fda0
1 changed files with 2 additions and 1 deletions
|
|
@ -186,12 +186,13 @@ nouveau_ws_device_new(drmDevicePtr drm_device)
|
|||
const char *path = drm_device->nodes[DRM_NODE_RENDER];
|
||||
struct nouveau_ws_device *device = CALLOC_STRUCT(nouveau_ws_device);
|
||||
uint64_t value = 0;
|
||||
drmVersionPtr ver = NULL;
|
||||
|
||||
int fd = open(path, O_RDWR | O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
goto out_err;
|
||||
|
||||
drmVersionPtr ver = drmGetVersion(fd);
|
||||
ver = drmGetVersion(fd);
|
||||
if (!ver)
|
||||
goto out_err;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue