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
This commit is contained in:
Kent Mein 2009-06-05 03:52:24 +00:00
parent d585a201e1
commit 010a9c0b00

@ -2844,13 +2844,16 @@ void PE_mirror_x(int tagged)
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) {