IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 22, 2007, 2:34:52 PM (19 years ago)
Author:
magnier
Message:

fixed memory leak in psFitsClose

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFits.c

    r12549 r12555  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-03-22 21:40:47 $
     9 *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-03-23 00:34:52 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6565            return false;
    6666        }
    67     }
    68 
     67        fits->fd = NULL;
     68    }
    6969    return true;
    7070}
     
    7272static void fitsFree(psFits* fits)
    7373{
    74     (void)fitsClose(fits);
     74    if (!fits) return;
     75    if (fits->fd) {
     76        fitsClose(fits);
     77    }
     78    psFree (fits->extword);
    7579}
    7680
     
    8488
    8589    bool status = fitsClose(fits);
    86     psMemSetDeallocator(fits,NULL);
    8790    psFree(fits);
    8891
     
    205208    PS_ASSERT_PTR_NON_NULL(extword, false);
    206209
    207     int status = 0;
    208210    int hdutype = 0;
    209211    char name[MAX_STRING_LENGTH];
     
    212214    for (int i = 1; true; i++) {
    213215        // are we able to read the next HDU?
     216
     217        int status = 0;
    214218        if (fits_movabs_hdu(fits->fd, i, &hdutype, &status)) {
    215219            char fitsErr[MAX_STRING_LENGTH];
     
    220224            return false;
    221225        }
    222         // is there a keyword called 'extword'?
    223         if (fits_read_key_str(fits->fd, (char *)extword, name, NULL, &status)) {
     226        // is there a keyword called 'extword'? (read as string regardless of type)
     227        status = 0;
     228        if (fits_read_keyword(fits->fd, (char *)extword, name, NULL, &status)) {
    224229            continue;
    225230        }
Note: See TracChangeset for help on using the changeset viewer.