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:
Vinson Lee
2022-11-20 14:08:50 -08:00
committed by Marge Bot
parent e3b1f26a2b
commit d6d772d3d1

View File

@@ -392,8 +392,10 @@ agx_resource_create_with_modifiers(struct pipe_screen *screen,
nresource->modifier = agx_select_modifier_from_list(nresource, modifiers, count);
/* 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;
}
} else {
nresource->modifier = agx_select_best_modifier(nresource);