summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2018-04-19 04:49:01 -0500
committerMarco Trevisan <mail@3v1n0.net>2018-04-25 09:09:04 +0000
commit7076a48bcfb9afe85cdcbe65e7f7294eb001e7e7 (patch)
treec6c039119e03f28a8cc0f49f7d03220be7b457fa
parent1b439c42d1b0d9d53abe6b9052f26d3b355b57d4 (diff)
downloadmutter-7076a48bcfb9afe85cdcbe65e7f7294eb001e7e7.tar.gz
cogl: Do not unref a NULL object
Add return-if-fail statement to avoid deferencing NULL object (cherry picked from commit 3104d697c0c66748ba0b005c145061499b3f1090)
-rw-r--r--cogl/cogl/cogl-object.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cogl/cogl/cogl-object.c b/cogl/cogl/cogl-object.c
index 1b849d58c..e159c6c3a 100644
--- a/cogl/cogl/cogl-object.c
+++ b/cogl/cogl/cogl-object.c
@@ -109,7 +109,11 @@ _cogl_object_default_unref (void *object)
void
cogl_object_unref (void *obj)
{
- void (* unref_func) (void *) = ((CoglObject *) obj)->klass->virt_unref;
+ void (* unref_func) (void *);
+
+ _COGL_RETURN_IF_FAIL (obj != NULL);
+
+ unref_func = ((CoglObject *) obj)->klass->virt_unref;
unref_func (obj);
}