IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16200


Ignore:
Timestamp:
Jan 23, 2008, 11:28:15 AM (18 years ago)
Author:
eugene
Message:

do not free newExp too early; check for end_stage is NULL before using

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/regtool.c

    r16170 r16200  
    628628    tess_id   = tess_id ? tess_id : newExp->tess_id;
    629629    end_stage = end_stage ? end_stage : newExp->end_stage;
    630 
    631     psFree(newExp);
     630    // don't free newExp until just before we return, or these refs will break
    632631
    633632    if (!rawExpInsert(config->dbh,
     
    694693        }
    695694        psError(PS_ERR_UNKNOWN, false, "database error");
     695        psFree(newExp);
    696696        return false;
    697697    }
     
    704704        }
    705705        psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id);
     706        psFree(newExp);
    706707        return false;
    707708    }
    708709
    709710    // should we stop here and proceed on to the chip stage?
    710     if (psStrcasestr(end_stage, "reg")) {
     711    // NULL for end_stage means go as far as possible
     712    if (end_stage && psStrcasestr(end_stage, "reg")) {
    711713        // then we are done here
    712714        if (!psDBCommit(config->dbh)) {
     
    715717        }
    716718
     719        psFree(newExp);
    717720        return true;
    718721    }
     
    737740        }
    738741        psError(PS_ERR_UNKNOWN, false, "failed to queue chipPendingExp");
     742        psFree(newExp);
    739743        return false;
    740744    }
     
    742746    if (!psDBCommit(config->dbh)) {
    743747        psError(PS_ERR_UNKNOWN, false, "database error");
    744         return false;
    745     }
    746 
     748        psFree(newExp);
     749        return false;
     750    }
     751
     752    psFree(newExp);
    747753    return true;
    748754}
Note: See TracChangeset for help on using the changeset viewer.