IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2703


Ignore:
Timestamp:
Dec 13, 2004, 10:49:56 AM (22 years ago)
Author:
desonia
Message:

fixed errors caused indirectly from the psList change.

Location:
trunk/psLib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/psLib.kdevses

    r2694 r2703  
    33<KDevPrjSession>
    44 <DocsAndViews NumberOfDocuments="2" >
    5   <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/test/astronomy/tst_psMetadataIO.c" >
    6    <View0 line="49" Type="Source" />
     5  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psList.c" >
     6   <View0 line="39" Type="Source" />
    77  </Doc0>
    8   <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/test/astronomy/tst_psMetadata_01.c" >
    9    <View0 line="76" Type="Source" />
     8  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psList.h" >
     9   <View0 line="0" Type="Source" />
    1010  </Doc1>
    1111 </DocsAndViews>
  • trunk/psLib/src/sys/psErrorCodes.c

    r2681 r2703  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-12-10 02:50:15 $
     9 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-12-13 20:49:56 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7979        while ((desc = (psErrorDescription*)psListGetNext(iter)) != NULL) {
    8080            if (desc->code == code) {
     81                psFree(iter);
    8182                return desc;
    8283            }
    8384        }
     85        psFree(iter);
    8486    }
    8587    return NULL;
     
    140142        dynamicErrorCodes = psListAlloc(NULL);
    141143        p_psMemSetPersistent(dynamicErrorCodes,true);
     144
     145        p_psMemSetPersistent(dynamicErrorCodes->iterators,true);
     146        p_psMemSetPersistent(dynamicErrorCodes->iterators->data,true);
     147        for (int i = 0; i < dynamicErrorCodes->iterators->n;i++) {
     148            p_psMemSetPersistent(dynamicErrorCodes->iterators->data[i],true);
     149        }
    142150    }
    143151
  • trunk/psLib/src/sys/psMemory.c

    r2562 r2703  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-12-01 00:56:32 $
     10*  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-12-13 20:49:56 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    431431        psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    432432
    433         psError(PS_ERR_MEMORY_DEREF_USAGE,true,
    434                 PS_ERRORTEXT_psMemory_MULTIPLE_FREE,
     433        psAbort(__func__,PS_ERRORTEXT_psMemory_MULTIPLE_FREE,
    435434                ptr->id, ptr->file, ptr->lineno, file, lineno);
    436 
    437         return;
    438     }
     435    }
     436
     437    if (checkMemBlock(ptr, __func__) != 0) {
     438        memProblemCallback(ptr, file, lineno);
     439        psAbort(__func__,"Memory Corruption Detected.");
     440    }
     441
    439442    (void)p_psMemDecrRefCounter(vptr, file, lineno);    // this handles the free, if required.
    440443}
  • trunk/psLib/src/sysUtils/psErrorCodes.c

    r2681 r2703  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-12-10 02:50:15 $
     9 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-12-13 20:49:56 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7979        while ((desc = (psErrorDescription*)psListGetNext(iter)) != NULL) {
    8080            if (desc->code == code) {
     81                psFree(iter);
    8182                return desc;
    8283            }
    8384        }
     85        psFree(iter);
    8486    }
    8587    return NULL;
     
    140142        dynamicErrorCodes = psListAlloc(NULL);
    141143        p_psMemSetPersistent(dynamicErrorCodes,true);
     144
     145        p_psMemSetPersistent(dynamicErrorCodes->iterators,true);
     146        p_psMemSetPersistent(dynamicErrorCodes->iterators->data,true);
     147        for (int i = 0; i < dynamicErrorCodes->iterators->n;i++) {
     148            p_psMemSetPersistent(dynamicErrorCodes->iterators->data[i],true);
     149        }
    142150    }
    143151
  • trunk/psLib/src/sysUtils/psMemory.c

    r2562 r2703  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-12-01 00:56:32 $
     10*  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-12-13 20:49:56 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    431431        psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    432432
    433         psError(PS_ERR_MEMORY_DEREF_USAGE,true,
    434                 PS_ERRORTEXT_psMemory_MULTIPLE_FREE,
     433        psAbort(__func__,PS_ERRORTEXT_psMemory_MULTIPLE_FREE,
    435434                ptr->id, ptr->file, ptr->lineno, file, lineno);
    436 
    437         return;
    438     }
     435    }
     436
     437    if (checkMemBlock(ptr, __func__) != 0) {
     438        memProblemCallback(ptr, file, lineno);
     439        psAbort(__func__,"Memory Corruption Detected.");
     440    }
     441
    439442    (void)p_psMemDecrRefCounter(vptr, file, lineno);    // this handles the free, if required.
    440443}
  • trunk/psLib/test/sysUtils/tst_psMemory.c

    r2561 r2703  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-12-01 00:55:34 $
     8*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-12-13 20:49:56 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4646
    4747testDescription tests[] = {
    48                               {
    49                                   TPCheckBufferPositive, 449, "checkBufferPositive", 0, false
    50                               },
    51                               {
    52                                   TPOutOfMemory, 450, "outOfMemory", -6, false
    53                               },
    54                               {
    55                                   TPReallocOutOfMemory, 562, "reallocOutOfMemory", -6, false
    56                               },
    57                               {
    58                                   TPrealloc, 451, "psRealloc", 0, false
    59                               },
    60                               {
    61                                   TPallocCallback, 452, "allocCallback", 0, false
    62                               },
    63                               {
    64                                   TPallocCallback, 453, "allocCallback2", 0, true
    65                               },
    66                               {
    67                                   TPcheckLeaks, 454, "checkLeaks", 0, false
    68                               },
    69                               {
    70                                   TPmemCorruption, 455, "psMemCorruption", 0, false
    71                               },
    72                               {
    73                                   TPFreeReferencedMemory, 456, "freeReferencedMemory", 0, false
    74                               },
    75                               {
    76                                   TPmultipleFree, 699, "multipleFree", 0, false
    77                               },
    78                               {
    79                                   NULL
    80                               }
     48                              {TPCheckBufferPositive, 449, "checkBufferPositive", 0, false},
     49                              {TPOutOfMemory, 450, "outOfMemory", -6, false},
     50                              {TPReallocOutOfMemory, 562, "reallocOutOfMemory", -6, false},
     51                              {TPrealloc, 451, "psRealloc", 0, false},
     52                              {TPallocCallback, 452, "allocCallback", 0, false},
     53                              {TPallocCallback, 453, "allocCallback2", 0, true},
     54                              {TPcheckLeaks, 454, "checkLeaks", 0, false},
     55                              {TPmemCorruption, 455, "psMemCorruption", 0, false},
     56                              {TPFreeReferencedMemory, 456, "freeReferencedMemory", 0, false},
     57                              {TPmultipleFree, 699, "multipleFree", -6, false},
     58                              {NULL}
    8159                          };
    8260
    83 psS32 main( psS32 argc, char* argv[] )
     61psS32 main(psS32 argc, char* argv[])
    8462{
    8563    psLogSetLevel( PS_LOG_INFO );
     
    550528    psFree( buffer );
    551529
    552     psLogMsg( __func__, PS_LOG_INFO, "Next should be an error about multiple freeing." );
     530    psLogMsg( __func__, PS_LOG_INFO, "Next should abort due to multiple freeing." );
    553531    psFree( buffer );
    554532
    555     psErr* err = (psErr*)psErrorLast();
    556 
    557     if (err->code != PS_ERR_MEMORY_DEREF_USAGE) {
    558         psError(PS_ERR_UNKNOWN,true,
    559                 "Multiple psFree calls generated wrong error code (%d)",
    560                 err->code);
    561         psFree(err);
    562         return 1;
    563     }
    564 
    565     psFree(err);
    566 
    567     return 0;
    568 }
     533    psError(PS_ERR_UNKNOWN,true,
     534            "Multiple psFree call survived");
     535
     536    return 0;
     537}
  • trunk/psLib/test/sysUtils/verified/tst_psMemory.stderr

    r2280 r2703  
    145145
    146146<DATE><TIME>|<HOST>|I|TPmultipleFree
    147     Next should be an error about multiple freeing.
    148 <DATE><TIME>|<HOST>|E|p_psFree (psMemory.c:<LINENO>)
     147    Next should abort due to multiple freeing.
     148<DATE><TIME>|<HOST>|A|p_psFree
    149149    Block 1, allocated at tst_psMemory.c:<LINENO>, freed multiple times at tst_psMemory.c:<LINENO>.
    150150
Note: See TracChangeset for help on using the changeset viewer.