[mutter] cogl: Do not unref a NULL object
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl: Do not unref a NULL object
- Date: Wed, 25 Apr 2018 09:05:56 +0000 (UTC)
commit 3104d697c0c66748ba0b005c145061499b3f1090
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Thu Apr 19 04:49:01 2018 -0500
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]