IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1010


Ignore:
Timestamp:
Jun 11, 2004, 4:17:25 PM (22 years ago)
Author:
desonia
Message:

added some psImageFree commands to avoid memory leaks when a NULL is returned.

Location:
trunk/psLib/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psFFT.c

    r1008 r1010  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-06-12 01:33:16 $
     7 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-06-12 02:17:25 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535    /* got good image data? */
    3636    if (in==NULL) {
     37        psImageFree(out);
    3738        return NULL;
    3839    }
     
    4344        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    4445                type);
     46        psImageFree(out);
    4547        return NULL;
    4648    }
     
    4951        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    5052                type);
     53        psImageFree(out);
    5154        return NULL;
    5255
     
    9598
    9699    if (in == NULL) {
     100        psImageFree(out);
    97101        return NULL;
    98102    }
     
    154158
    155159    if (in == NULL) {
     160        psImageFree(out);
    156161        return NULL;
    157162    }
     
    215220
    216221    if (real == NULL || imag == NULL) {
     222        psImageFree(out);
    217223        return NULL;
    218224    }
     
    224230    if (imag->type.type != type) {
    225231        psError(__func__,"The inputs to psImageComplex must be the same type.");
     232        psImageFree(out);
    226233        return NULL;
    227234    }
     
    230237            imag->numRows != numRows) {
    231238        psError(__func__,"The inputs to psImageComplex must be the same dimensions.");
     239        psImageFree(out);
    232240        return NULL;
    233241    }
     
    235243    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    236244        psError(__func__,"The inputs to psImageComplex can not be complex.");
     245        psImageFree(out);
    237246        return NULL;
    238247    }
     
    240249    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
    241250        psError(__func__,"The input type to psImageComplex must be a floating point.");
     251        psImageFree(out);
    242252        return NULL;
    243253    }
     
    292302
    293303    if (in == NULL) {
     304        psImageFree(out);
    294305        return NULL;
    295306    }
     
    351362
    352363    if (in == NULL) {
     364        psImageFree(out);
    353365        return NULL;
    354366    }
     
    362374    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    363375        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
     376        psImageFree(out);
    364377        return NULL;
    365378    }
     
    422435    /* got good image data? */
    423436    if (in==NULL) {
     437        psVectorFree(out);
    424438        return NULL;
    425439    }
     
    430444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    431445                type);
     446        psVectorFree(out);
    432447        return NULL;
    433448    }
     
    436451        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    437452                type);
     453        psVectorFree(out);
    438454        return NULL;
    439455
     
    494510
    495511    if (in == NULL) {
     512        psVectorFree(out);
    496513        return NULL;
    497514    }
     
    539556
    540557    if (in == NULL) {
     558        psVectorFree(out);
    541559        return NULL;
    542560    }
     
    636654
    637655    if (in == NULL) {
     656        psVectorFree(out);
    638657        return NULL;
    639658    }
  • trunk/psLib/src/dataManip/psVectorFFT.c

    r1008 r1010  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-06-12 01:33:16 $
     7 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-06-12 02:17:25 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535    /* got good image data? */
    3636    if (in==NULL) {
     37        psImageFree(out);
    3738        return NULL;
    3839    }
     
    4344        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    4445                type);
     46        psImageFree(out);
    4547        return NULL;
    4648    }
     
    4951        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    5052                type);
     53        psImageFree(out);
    5154        return NULL;
    5255
     
    9598
    9699    if (in == NULL) {
     100        psImageFree(out);
    97101        return NULL;
    98102    }
     
    154158
    155159    if (in == NULL) {
     160        psImageFree(out);
    156161        return NULL;
    157162    }
     
    215220
    216221    if (real == NULL || imag == NULL) {
     222        psImageFree(out);
    217223        return NULL;
    218224    }
     
    224230    if (imag->type.type != type) {
    225231        psError(__func__,"The inputs to psImageComplex must be the same type.");
     232        psImageFree(out);
    226233        return NULL;
    227234    }
     
    230237            imag->numRows != numRows) {
    231238        psError(__func__,"The inputs to psImageComplex must be the same dimensions.");
     239        psImageFree(out);
    232240        return NULL;
    233241    }
     
    235243    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    236244        psError(__func__,"The inputs to psImageComplex can not be complex.");
     245        psImageFree(out);
    237246        return NULL;
    238247    }
     
    240249    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
    241250        psError(__func__,"The input type to psImageComplex must be a floating point.");
     251        psImageFree(out);
    242252        return NULL;
    243253    }
     
    292302
    293303    if (in == NULL) {
     304        psImageFree(out);
    294305        return NULL;
    295306    }
     
    351362
    352363    if (in == NULL) {
     364        psImageFree(out);
    353365        return NULL;
    354366    }
     
    362374    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    363375        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
     376        psImageFree(out);
    364377        return NULL;
    365378    }
     
    422435    /* got good image data? */
    423436    if (in==NULL) {
     437        psVectorFree(out);
    424438        return NULL;
    425439    }
     
    430444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    431445                type);
     446        psVectorFree(out);
    432447        return NULL;
    433448    }
     
    436451        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    437452                type);
     453        psVectorFree(out);
    438454        return NULL;
    439455
     
    494510
    495511    if (in == NULL) {
     512        psVectorFree(out);
    496513        return NULL;
    497514    }
     
    539556
    540557    if (in == NULL) {
     558        psVectorFree(out);
    541559        return NULL;
    542560    }
     
    636654
    637655    if (in == NULL) {
     656        psVectorFree(out);
    638657        return NULL;
    639658    }
  • trunk/psLib/src/fft/psVectorFFT.c

    r1008 r1010  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-06-12 01:33:16 $
     7 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-06-12 02:17:25 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535    /* got good image data? */
    3636    if (in==NULL) {
     37        psImageFree(out);
    3738        return NULL;
    3839    }
     
    4344        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    4445                type);
     46        psImageFree(out);
    4547        return NULL;
    4648    }
     
    4951        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    5052                type);
     53        psImageFree(out);
    5154        return NULL;
    5255
     
    9598
    9699    if (in == NULL) {
     100        psImageFree(out);
    97101        return NULL;
    98102    }
     
    154158
    155159    if (in == NULL) {
     160        psImageFree(out);
    156161        return NULL;
    157162    }
     
    215220
    216221    if (real == NULL || imag == NULL) {
     222        psImageFree(out);
    217223        return NULL;
    218224    }
     
    224230    if (imag->type.type != type) {
    225231        psError(__func__,"The inputs to psImageComplex must be the same type.");
     232        psImageFree(out);
    226233        return NULL;
    227234    }
     
    230237            imag->numRows != numRows) {
    231238        psError(__func__,"The inputs to psImageComplex must be the same dimensions.");
     239        psImageFree(out);
    232240        return NULL;
    233241    }
     
    235243    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    236244        psError(__func__,"The inputs to psImageComplex can not be complex.");
     245        psImageFree(out);
    237246        return NULL;
    238247    }
     
    240249    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
    241250        psError(__func__,"The input type to psImageComplex must be a floating point.");
     251        psImageFree(out);
    242252        return NULL;
    243253    }
     
    292302
    293303    if (in == NULL) {
     304        psImageFree(out);
    294305        return NULL;
    295306    }
     
    351362
    352363    if (in == NULL) {
     364        psImageFree(out);
    353365        return NULL;
    354366    }
     
    362374    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    363375        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
     376        psImageFree(out);
    364377        return NULL;
    365378    }
     
    422435    /* got good image data? */
    423436    if (in==NULL) {
     437        psVectorFree(out);
    424438        return NULL;
    425439    }
     
    430444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    431445                type);
     446        psVectorFree(out);
    432447        return NULL;
    433448    }
     
    436451        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    437452                type);
     453        psVectorFree(out);
    438454        return NULL;
    439455
     
    494510
    495511    if (in == NULL) {
     512        psVectorFree(out);
    496513        return NULL;
    497514    }
     
    539556
    540557    if (in == NULL) {
     558        psVectorFree(out);
    541559        return NULL;
    542560    }
     
    636654
    637655    if (in == NULL) {
     656        psVectorFree(out);
    638657        return NULL;
    639658    }
Note: See TracChangeset for help on using the changeset viewer.