IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29772


Ignore:
Timestamp:
Nov 12, 2010, 11:36:35 PM (15 years ago)
Author:
bills
Message:

avoid segv if psImageCovarianceAverage returns NULL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtraction.c

    r29599 r29772  
    13751375    // Calculate covariances
    13761376    // This can be fairly involved, so we only do it for a small number of instances
     1377        if (!out1->covariance) {
     1378            psError(PM_ERR_PROG, false, "psImageCovarianceAverage returned NULL.");
     1379            return false;
     1380        }
    13771381    float position[NUM_COVAR_POS] = { -1.0, -0.5, 0.0, +0.5, +1.0 }; // Positions for covariance calculations
    13781382    // Enable threads for covariance calculation, since we're not threading on top of it
     
    13911395        out1->covariance = psImageCovarianceAverage(covars);
    13921396        psFree(covars);
     1397        if (!out1->covariance) {
     1398            psError(PM_ERR_UNKNOWN, false, "psImageCovarianceAverage returned NULL for out1.");
     1399            return false;
     1400        }
    13931401        // Remove covariance factor from covariance, since we've put it in the variance map already
    13941402        float factor = psImageCovarianceFactor(out1->covariance);
     
    14081416        out2->covariance = psImageCovarianceAverage(covars);
    14091417        psFree(covars);
     1418        if (!out2->covariance) {
     1419            psError(PM_ERR_UNKNOWN, false, "psImageCovarianceAverage returned NULL for out2.");
     1420            return false;
     1421        }
    14101422        // Remove covariance factor from covariance, since we've put it in the variance map already
    14111423        float factor = psImageCovarianceFactor(out2->covariance);
Note: See TracChangeset for help on using the changeset viewer.