asahi: Fix memory leak on error path.
Fix defect reported by Coverity Scan.
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable nresource going out of scope leaks the storage it points to.
Fixes: 7522f4f714
("asahi: Make resource creation code modifier-aware")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19889>
This commit is contained in:
@@ -392,8 +392,10 @@ agx_resource_create_with_modifiers(struct pipe_screen *screen,
|
|||||||
nresource->modifier = agx_select_modifier_from_list(nresource, modifiers, count);
|
nresource->modifier = agx_select_modifier_from_list(nresource, modifiers, count);
|
||||||
|
|
||||||
/* There may not be a matching modifier, bail if so */
|
/* There may not be a matching modifier, bail if so */
|
||||||
if (nresource->modifier == DRM_FORMAT_MOD_INVALID)
|
if (nresource->modifier == DRM_FORMAT_MOD_INVALID) {
|
||||||
|
free(nresource);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
nresource->modifier = agx_select_best_modifier(nresource);
|
nresource->modifier = agx_select_best_modifier(nresource);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user