Changeset 458 for cpp/frams/model


Ignore:
Timestamp:
02/03/16 19:19:18 (4 years ago)
Author:
sz
Message:

fixed memory leaks in Model (when building from invalid f0 genotype)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/model.cpp

    r393 r458  
    570570        partparam.select(p);
    571571        pos+=2;
    572         if (partparam.load2(line,pos) & ParamInterface::LOAD2_PARSE_FAILED) return -1;
     572        if (partparam.load2(line,pos) & ParamInterface::LOAD2_PARSE_FAILED) {delete p; return -1;}
    573573        p->o.rotate(p->rot);
    574574        parts+=p;
     
    592592        pos+=2;
    593593        j->owner=this;
    594         if (jointparam.load2(line,pos) & ParamInterface::LOAD2_PARSE_FAILED) return -1;
     594        if (jointparam.load2(line,pos) & ParamInterface::LOAD2_PARSE_FAILED) {delete j; return -1;}
    595595        if ((j->p1_refno>=0)&&(j->p1_refno<getPartCount())&&
    596596           (j->p2_refno>=0)&&(j->p2_refno<getPartCount()))
     
    620620        neuroparam.select(nu);
    621621        pos+=2;
    622         if (neuroparam.load2(line,pos) & ParamInterface::LOAD2_PARSE_FAILED) return -1;
     622        if (neuroparam.load2(line,pos) & ParamInterface::LOAD2_PARSE_FAILED) {delete nu; return -1;}
    623623#ifdef MODEL_V1_COMPATIBLE
    624624        if (nu->neuro_refno>=0) // parent specified...
     
    706706        neuroitemparam.select(nu);
    707707        pos+=3;
    708         if (neuroitemparam.load2(line,pos) & ParamInterface::LOAD2_PARSE_FAILED) return -1;
     708        if (neuroitemparam.load2(line,pos) & ParamInterface::LOAD2_PARSE_FAILED) {delete nu; return -1;}
    709709        // illegal parent?
    710710        if ((nu->neuro_refno<0)||(nu->neuro_refno>=old_getNeuroCount()))
Note: See TracChangeset for help on using the changeset viewer.