Revision: 20644
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20644
Author:   sirdude
Date:     2009-06-05 05:52:24 +0200 (Fri, 05 Jun 2009)

Log Message:
-----------
coverity issues:
CID: 506
Checker: REVERSE_INULL (help)
File: base/src/source/blender/src/editparticle.c
Function: PE_mirror_x
Description: Pointer "(edit)->keys" dereferenced before NULL check

and
CID: 507
Checker: REVERSE_INULL (help)
File: base/src/source/blender/src/editparticle.c
Function: PE_mirror_x
Description: Pointer "(psys)->particles" dereferenced before NULL check


No need to copy the memory if the pointer isn't valid.

Kent

Modified Paths:
--------------
    trunk/blender/source/blender/src/editparticle.c

Modified: trunk/blender/source/blender/src/editparticle.c
===================================================================
--- trunk/blender/source/blender/src/editparticle.c     2009-06-05 03:40:58 UTC 
(rev 20643)
+++ trunk/blender/source/blender/src/editparticle.c     2009-06-05 03:52:24 UTC 
(rev 20644)
@@ -2844,13 +2844,16 @@
                new_pars= MEM_callocN(newtotpart*sizeof(ParticleData), 
"ParticleData new");
                new_keys= MEM_callocN(newtotpart*sizeof(ParticleEditKey*), 
"ParticleEditKey new");
 
-               memcpy(new_pars, psys->particles, totpart*sizeof(ParticleData));
-               memcpy(new_keys, edit->keys, totpart*sizeof(ParticleEditKey*));
-
-               if(psys->particles) MEM_freeN(psys->particles);
+               if(psys->particles) {
+                       memcpy(new_pars, psys->particles, 
totpart*sizeof(ParticleData));
+                       MEM_freeN(psys->particles);
+               }
                psys->particles= new_pars;
 
-               if(edit->keys) MEM_freeN(edit->keys);
+               if(edit->keys) {
+                       memcpy(new_keys, edit->keys, 
totpart*sizeof(ParticleEditKey*));
+                       MEM_freeN(edit->keys);
+               }
                edit->keys= new_keys;
 
                if(edit->mirror_cache) {


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to