1
0
Fork 0

cogl/texture-2d-sliced: Don't double-free slice array when alloc failed

If texture allocation failed for a sliced 2D texture, the alloc()
function would free the slices immediately, but not clear the pointer to
the slices array. When the code attempting to allocate the texture then
freed the texture object, the cleanup functions tried to free the slices
array again, since it wasn't NULL.

Fix this by clearing the slices array after freeing it.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1580
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1648>
This commit is contained in:
Jonas Ådahl 2020-12-18 11:24:32 +01:00 committed by Marge Bot
parent ae6d83fb47
commit 96842fc570

View file

@ -760,6 +760,7 @@ free_slices (CoglTexture2DSliced *tex_2ds)
} }
g_array_free (tex_2ds->slice_textures, TRUE); g_array_free (tex_2ds->slice_textures, TRUE);
tex_2ds->slice_textures = NULL;
} }
free_spans (tex_2ds); free_spans (tex_2ds);