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



commit 9ed5ddde4c244b549da07fd0d1063fd37c030e09
Author: Hans Breuer <hans breuer org>
Date:   Sun Aug 18 10:53:43 2013 +0200

    [scan-build] Dereference of null pointer
    
    Array access (via field 'handles') results in a null pointer dereference
    But only if the logic would be screwed. Now the g_return_if_fail() is
    more strict to handle that case, too.

 lib/standard-path.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/lib/standard-path.c b/lib/standard-path.c
index 7e63b4e..4f2fe34 100644
--- a/lib/standard-path.c
+++ b/lib/standard-path.c
@@ -225,7 +225,7 @@ stdpath_init_handles (StdPath *stdpath)
   DiaObject *obj = &stdpath->object;
   int i;
 
-  g_return_if_fail (obj->handles != NULL || obj->num_handles == NUM_HANDLES);
+  g_return_if_fail (obj->handles != NULL && obj->num_handles == NUM_HANDLES);
 
   for (i = 0; i < NUM_HANDLES; ++i) {
     obj->handles[i] = &stdpath->handles[i];


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