mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
virgl: Allocate qdws after virgl_init_context to avoid leak.
Fix defect reported by Coverity Scan. Resource leak (RESOURCE_LEAK) leaked_storage: Variable qdws going out of scope leaks the storage it points to. Fixes:9a7d6a110e("virgl/drm: explicit context initialization") Suggested-by: Gert Wollny <gert.wollny@collabora.com> Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13609> (cherry picked from commit4a38ed822a)
This commit is contained in:
parent
764e965f37
commit
a728b8a732
2 changed files with 5 additions and 5 deletions
|
|
@ -1696,7 +1696,7 @@
|
|||
"description": "virgl: Allocate qdws after virgl_init_context to avoid leak.",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "9a7d6a110e2a407ead13d0eb2f1aedbdb54e696b"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1220,16 +1220,16 @@ virgl_drm_winsys_create(int drmFD)
|
|||
if (drm_version < 0)
|
||||
return NULL;
|
||||
|
||||
qdws = CALLOC_STRUCT(virgl_drm_winsys);
|
||||
if (!qdws)
|
||||
return NULL;
|
||||
|
||||
if (params[param_context_init].value) {
|
||||
ret = virgl_init_context(drmFD);
|
||||
if (ret)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qdws = CALLOC_STRUCT(virgl_drm_winsys);
|
||||
if (!qdws)
|
||||
return NULL;
|
||||
|
||||
qdws->fd = drmFD;
|
||||
virgl_resource_cache_init(&qdws->cache, CACHE_TIMEOUT_USEC,
|
||||
virgl_drm_resource_cache_entry_is_busy,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue