Unref: handle null pointers
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 4 May 2011 20:04:09 +0000 (16:04 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 4 May 2011 20:04:09 +0000 (16:04 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
types/types.c

index 2a9a50922c6f5b62c2cc212b513bffdbb98eb2ba..08324acc481dd5e594525282d3329d4a15459f41 100644 (file)
@@ -255,6 +255,8 @@ void declaration_ref(struct declaration *declaration)
 
 void declaration_unref(struct declaration *declaration)
 {
+       if (!declaration)
+               return;
        if (!--declaration->ref)
                declaration->declaration_free(declaration);
 }
@@ -266,6 +268,8 @@ void definition_ref(struct definition *definition)
 
 void definition_unref(struct definition *definition)
 {
+       if (!definition)
+               return;
        if (!--definition->ref)
                definition->declaration->definition_free(definition);
 }
This page took 0.032884 seconds and 4 git commands to generate.