forked from bartvdbraak/blender
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:
parent
d585a201e1
commit
010a9c0b00
@ -2844,13 +2844,16 @@ void PE_mirror_x(int tagged)
|
|||||||
new_pars= MEM_callocN(newtotpart*sizeof(ParticleData), "ParticleData new");
|
new_pars= MEM_callocN(newtotpart*sizeof(ParticleData), "ParticleData new");
|
||||||
new_keys= MEM_callocN(newtotpart*sizeof(ParticleEditKey*), "ParticleEditKey new");
|
new_keys= MEM_callocN(newtotpart*sizeof(ParticleEditKey*), "ParticleEditKey new");
|
||||||
|
|
||||||
memcpy(new_pars, psys->particles, totpart*sizeof(ParticleData));
|
if(psys->particles) {
|
||||||
memcpy(new_keys, edit->keys, totpart*sizeof(ParticleEditKey*));
|
memcpy(new_pars, psys->particles, totpart*sizeof(ParticleData));
|
||||||
|
MEM_freeN(psys->particles);
|
||||||
if(psys->particles) MEM_freeN(psys->particles);
|
}
|
||||||
psys->particles= new_pars;
|
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;
|
edit->keys= new_keys;
|
||||||
|
|
||||||
if(edit->mirror_cache) {
|
if(edit->mirror_cache) {
|
||||||
|
Loading…
Reference in New Issue
Block a user