[dia] [scan-build] Dereference of null pointer



commit beef3f52fa6af33327b55705b735d33c4cebac5b
Author: Hans Breuer <hans breuer org>
Date:   Wed Jun 29 22:25:17 2011 +0200

    [scan-build] Dereference of null pointer
    
    Access to field 'name' results in a dereference of a null pointer
    (loaded from variable 'alias_type')
    
    Indeed there was a logic error: both pointers need to be valid.

 lib/object-alias.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/lib/object-alias.c b/lib/object-alias.c
index 8d9f4c1..8d1b42e 100644
--- a/lib/object-alias.c
+++ b/lib/object-alias.c
@@ -106,7 +106,7 @@ _alias_create (Point *startpoint,
   DiaObjectType *alias_type = (DiaObjectType *)user_data;
   DiaObjectType *real_type;
   
-  g_return_val_if_fail (alias_type != NULL || alias_type->name != NULL, NULL);
+  g_return_val_if_fail (alias_type != NULL && alias_type->name != NULL, NULL);
 
   real_type = _alias_lookup (alias_type->name);
   if (!real_type)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]