IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1164


Ignore:
Timestamp:
Jun 30, 2004, 2:23:52 PM (22 years ago)
Author:
harman
Message:

Added psAbort for failed memory allocation

Location:
trunk/psLib/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/image/psImage.c

    r1073 r1164  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-06-23 23:00:15 $
     11 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-07-01 00:23:52 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050
    5151    psImage *image = (psImage *)psAlloc(sizeof(psImage));
     52    if(image == NULL) {
     53        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
     54    }
     55
    5256    p_psMemSetDeallocator(image,(psFreeFcn)imageFree);
    5357
    5458    image->data.V = psAlloc(sizeof(void*)*numRows);
     59    if(image->data.V == NULL) {
     60        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
     61    }
     62
    5563
    5664    image->data.V[0] = psAlloc(area*elementSize);
     65    if(image->data.V[0] == NULL) {
     66        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
     67    }
    5768
    5869    for(int i = 1; i < numRows; i++) {
  • trunk/psLib/src/mathtypes/psImage.c

    r1073 r1164  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-06-23 23:00:15 $
     11 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-07-01 00:23:52 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050
    5151    psImage *image = (psImage *)psAlloc(sizeof(psImage));
     52    if(image == NULL) {
     53        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
     54    }
     55
    5256    p_psMemSetDeallocator(image,(psFreeFcn)imageFree);
    5357
    5458    image->data.V = psAlloc(sizeof(void*)*numRows);
     59    if(image->data.V == NULL) {
     60        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
     61    }
     62
    5563
    5664    image->data.V[0] = psAlloc(area*elementSize);
     65    if(image->data.V[0] == NULL) {
     66        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
     67    }
    5768
    5869    for(int i = 1; i < numRows; i++) {
Note: See TracChangeset for help on using the changeset viewer.