From 96842fc570b5e244d6614949b8a208ac084efb1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 18 Dec 2020 11:24:32 +0100 Subject: [PATCH] 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: --- cogl/cogl/cogl-texture-2d-sliced.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cogl/cogl/cogl-texture-2d-sliced.c b/cogl/cogl/cogl-texture-2d-sliced.c index 2d903e83b..8e7f91f70 100644 --- a/cogl/cogl/cogl-texture-2d-sliced.c +++ b/cogl/cogl/cogl-texture-2d-sliced.c @@ -760,6 +760,7 @@ free_slices (CoglTexture2DSliced *tex_2ds) } g_array_free (tex_2ds->slice_textures, TRUE); + tex_2ds->slice_textures = NULL; } free_spans (tex_2ds);