[Cogl] [PATCH] primitive: Don't leak indices

Robert Bragg robert at sixbynine.org
Tue Aug 28 08:47:13 PDT 2012


From: Robert Bragg <robert at linux.intel.com>

If a CoglPrimitive is associated with a set of indices then we must
unref those indices when freeing the primitive to avoid a leak.
---
 cogl/cogl-primitive.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/cogl/cogl-primitive.c b/cogl/cogl-primitive.c
index db80ca2..6f3a40e 100644
--- a/cogl/cogl-primitive.c
+++ b/cogl/cogl-primitive.c
@@ -380,6 +380,9 @@ _cogl_primitive_free (CoglPrimitive *primitive)
     g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
                    primitive->attributes);
 
+  if (primitive->indices)
+    cogl_object_unref (primitive->indices);
+
   g_slice_free1 (sizeof (CoglPrimitive) +
                  sizeof (CoglAttribute *) *
                  (primitive->n_embedded_attributes - 1), primitive);
-- 
1.7.7.6



More information about the Cogl mailing list