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>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user