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:
7522f4f7147 ("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>
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);