From 3104d697c0c66748ba0b005c145061499b3f1090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 19 Apr 2018 04:49:01 -0500 Subject: [PATCH] cogl: Do not unref a NULL object Add return-if-fail statement to avoid deferencing NULL object --- cogl/cogl/cogl-object.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); }