This commit fixes the following two coverity issues:
authorKent Mein <mein@cs.umn.edu>
Tue, 2 Jun 2009 19:29:20 +0000 (19:29 +0000)
committerKent Mein <mein@cs.umn.edu>
Tue, 2 Jun 2009 19:29:20 +0000 (19:29 +0000)
CID: 475
Checker: REVERSE_INULL (help)
File: base/src/source/blender/blenkernel/intern/cloth.c
Function: bvhselftree_build_from_cloth
Description: Pointer "clmd" dereferenced before NULL check

CID: 476
Checker: REVERSE_INULL (help)
File: base/src/source/blender/blenkernel/intern/cloth.c
Function: bvhtree_build_from_cloth
Description: Pointer "clmd" dereferenced before NULL check

You'll notice in the code the var is actually set again
a few lines down before being used so better to set it
after you've made sure the pointer is valid.

Kent

source/blender/blenkernel/intern/cloth.c

index dbc94571cad9b885950321d22a3ca16f9d8c16a3..f74c96482e0b72af7255a699c455e339dfb35489 100644 (file)
@@ -157,7 +157,7 @@ BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float epsilon)
 {
        unsigned int i;
        BVHTree *bvhtree;
-       Cloth *cloth = clmd->clothObject;
+       Cloth *cloth;
        ClothVertex *verts;
        MFace *mfaces;
        float co[12];
@@ -198,7 +198,7 @@ BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon)
 {
        unsigned int i;
        BVHTree *bvhtree;
-       Cloth *cloth = clmd->clothObject;
+       Cloth *cloth;
        ClothVertex *verts;
        MFace *mfaces;
        float co[12];