[mutter] cogl/texture-2d-sliced: Don't double-free slice array when alloc failed
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl/texture-2d-sliced: Don't double-free slice array when alloc failed
- Date: Fri, 18 Dec 2020 16:50:20 +0000 (UTC)
commit 96842fc570b5e244d6614949b8a208ac084efb1e
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Dec 18 11:24:32 2020 +0100
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>
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 2d903e83b2..8e7f91f703 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]