IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9745


Ignore:
Timestamp:
Oct 24, 2006, 6:58:39 PM (20 years ago)
Author:
drobbin
Message:

Fixed LookupTable to error when a partially-constructed table row is encountered. Also fixed memory leak associated with this case.

Location:
trunk/psLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/types/psLookupTable.c

    r9730 r9745  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-10-24 22:52:56 $
     9*  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-10-25 04:58:38 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    564564                            return NULL;
    565565                        }
     566                    }
     567                    if (strValue != NULL && strNum == NULL) {
     568                        psError(PS_ERR_UNKNOWN, true,
     569                                "Parsing text file failed - missing table value(s).");
     570                        fclose(fp);
     571                        psFree(outputArray);
     572                        psFree(line);
     573                        psFree(strValue);
     574                        return NULL;
    566575                    }
    567576                }  // ignore line
  • trunk/psLib/test/types/tap_psLookupTable_all.c

    r9714 r9745  
    2424int main(void)
    2525{
    26     plan_tests(27);
     26    plan_tests(28);
    2727
    2828    diag("Tests for psLookupTable Functions");
     
    149149            "psVectorsReadFromFile:           return NULL for empty table.");
    150150    }
     151    // Attempt to read from file with partially constructed row
     152    {
     153        outVec = psVectorsReadFromFile("table3.dat",
     154                                       "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf");
     155        ok( outVec == NULL,
     156            "psVectorsReadFromFile:           return NULL for table with partially"
     157            " constructed row.");
     158    }
    151159    //Attempt to read with valid inputs
    152160    {
Note: See TracChangeset for help on using the changeset viewer.