primitive: Don't leak indices

If a CoglPrimitive is associated with a set of indices then we must
unref those indices when freeing the primitive to avoid a leak.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 45cac786b55c953e44f98b864add952b9e398b13)
This commit is contained in:
Robert Bragg 2012-08-07 15:25:21 +01:00
parent 74d749eca4
commit 971b5cfae1

View File

@ -380,6 +380,9 @@ _cogl_primitive_free (CoglPrimitive *primitive)
g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes, g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
primitive->attributes); primitive->attributes);
if (primitive->indices)
cogl_object_unref (primitive->indices);
g_slice_free1 (sizeof (CoglPrimitive) + g_slice_free1 (sizeof (CoglPrimitive) +
sizeof (CoglAttribute *) * sizeof (CoglAttribute *) *
(primitive->n_embedded_attributes - 1), primitive); (primitive->n_embedded_attributes - 1), primitive);