IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11147


Ignore:
Timestamp:
Jan 18, 2007, 4:03:14 PM (19 years ago)
Author:
Paul Price
Message:

Fixing memory corruption induced by wrong placement of "if (faulted)" block.

File:
1 edited

Legend:

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

    r11143 r11147  
    981981        return false;
    982982    }
    983    
     983
    984984    // lookup the detRun that we will be basing this one on
    985985    psArray *detRuns = NULL;
     
    999999        return false;                   // unreachable
    10001000    }
    1001    
     1001
    10021002    // pull the detRun object out the result array
    10031003    detRunRow *detRun = psMemIncrRefCounter(detRuns->data[0]);
    1004  
     1004
    10051005    // discard the resultarray
    10061006    psFree(detRuns)
     
    10081008    // set the det_id to 0/NULL so the database can assign it
    10091009    detRun->det_id = 0;
    1010    
     1010
    10111011    // reset the iteration to 0
    10121012    detRun->iteration = 0;
    1013    
     1013
    10141014    // reset the state to "run"
    10151015    psFree(detRun->state);
     
    12191219    psFree(detRun);
    12201220
    1221     // get the det_id 
     1221    // get the det_id
    12221222    long newDet_id = psDBLastInsertID(config->dbh);
    12231223
     
    23272327    }
    23282328
    2329     if (!p_psDBRunQuery(config->dbh, query)) {
    2330         psError(PS_ERR_UNKNOWN, false, "database error");
    2331         psFree(query);
    2332         return false;
    2333     }
    2334     psFree(query);
    2335 
    23362329    if (faulted) {
    23372330        // list only faulted rows
     
    23412334        psStringAppend(&query, " %s", "AND detProcessedImfile.fault = 0");
    23422335    }
     2336
     2337    if (!p_psDBRunQuery(config->dbh, query)) {
     2338        psError(PS_ERR_UNKNOWN, false, "database error");
     2339        psFree(query);
     2340        return false;
     2341    }
     2342    psFree(query);
    23432343
    23442344    // treat limit == 0 as "no limit"
     
    32553255    }
    32563256#endif
    3257    
     3257
    32583258    // treat limit == 0 as "no limit"
    32593259    if (limit) {
     
    60686068    // check that state is a valid string value
    60696069    if (!(
    6070             (strncmp(state, "run", 4) == 0) 
    6071             || (strncmp(state, "stop", 5) == 0) 
    6072             || (strncmp(state, "reg", 4) == 0) 
     6070            (strncmp(state, "run", 4) == 0)
     6071            || (strncmp(state, "stop", 5) == 0)
     6072            || (strncmp(state, "reg", 4) == 0)
    60736073        )
    60746074    ) {
     
    60956095    // check that state is a valid string value
    60966096    if (!(
    6097             (strncmp(mode, "master", 7) == 0) 
    6098             || (strncmp(mode, "verify", 7) == 0) 
     6097            (strncmp(mode, "master", 7) == 0)
     6098            || (strncmp(mode, "verify", 7) == 0)
    60996099        )
    61006100    ) {
Note: See TracChangeset for help on using the changeset viewer.