Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Leak  at trcsort.c:786

Categories: ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 482.29256
Procedure: get_tmpfile
Trace: view
Modified: Thu Nov 26 11:36:28 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
ProblemLineSource
   /kat0/fletcher/SATE/2010/pvm3/tracer/trcsort.c
   Enter get_tmpfile
 737 get_tmpfile( tid, tmptp, createflag ) 
 738 int tid;
 739 struct timeval *tmptp;
 740 int createflag;
 741 {
 742         TMPFILE TF;
 743  
 744         static struct timeval delta = { 0, 0 };
 745  
 746         char fname[255];
 747  
 748         int index;
 749  
 750         TF = TMPF;
 751  
 752         index = 1;
 753  
 754         while ( TF != NULL )
 755         {
 756                 if ( TF->tid == tid )
 757                 {
 758                         if ( ( tmptp->tv_sec == -1 && tmptp->tv_usec == -1 )
 759                                         || TIME_COMPARE( *tmptp, TF->lasttime ) >= 0 )
 760                         {
 761                                 return( TF );
 762                         }
 763  
 764                         delta.tv_sec = TF->delta.tv_sec;
 765                         delta.tv_usec = TF->delta.tv_usec;
 766  
 767                         index++;
 768                 }
 769  
 770                 TF = TF->next;
 771         }
 772  
 773         if ( !createflag )
 774                 return( (TMPFILE) NULL );
 775  
 776         TF = create_tmpfile();
 777  
 778         TF->tid = tid;
 779  
 780         if ( index > 1 )
 781                 sprintf( fname, "%s/tmp.%x.%d", DIRNAME, tid, index );
 782  
 783         else 
 784                 sprintf( fname, "%s/tmp.%x", DIRNAME, tid );
 785  
allocated inside call786         TF->fname = trc_copy_str( fname );     /* Leak */
     /kat0/fletcher/SATE/2010/pvm3/tracer/trcutil.c
     Enter get_tmpfile / trc_copy_str
 3031   char * 
 3032   trc_copy_str( str ) 
 3033   char *str;
 3034   {
 3035           char *tmp;
 3036    
referenced by returned value3037           tmp = (char *) malloc( (unsigned) (strlen(str) + 1)   /* Uninitialized Variable (ID: 22160.29169) */  /* 2 more... */
 3038                   * sizeof(char) );
referenced by tmp3039           trc_memcheck(tmp,"Copy String");
 3040    
 3041           strcpy( tmp, str );
 3042    
 3043           return( tmp );
referenced by returned value3044   } 
     Exit get_tmpfile / trc_copy_str
 787  
referenced by TF->fname788         if ( !verify_fp( TF, "w" ) )
 789         {
 790                 free( TF );
 791                 return( (TMPFILE) NULL );
 792         }
 793  
 794         if ( index > 1 )
 795         {
 796                 TF->delta.tv_sec = delta.tv_sec;
 797                 TF->delta.tv_usec = delta.tv_usec;
 798         }
 799  
 800         TF->next = TMPF;
 801  
 802         TMPF = TF;
 803  
 804         return( TF );
 805 } 
Preconditions
createflag != 0
strlen(&DIRNAME[0]) >= -13
NFPS <= 9
TMPF = 0
vflag = 0
Postconditions
*stderr' is allocated by fopen
bytes_before(stderr)' = 0
errno' != 0
$heap_436823' = 0
bytes_after(&$heap_436823)' = 60
$heap_436823' is allocated by malloc
$heap_436823' is freed
bytes_before(&$heap_436823)' = 0
((char*)&$heap_436823)[16]' = 0
((char*)&$heap_436823)[20]' = $param_1
((char*)&$heap_436823)[24]' = -1
((char*)&$heap_436823)[28]' = -1
((char*)&$heap_436823)[32]' = -1
((char*)&$heap_436823)[36]' = -1
((char*)&$heap_436823)[40]' = 0
((char*)&$heap_436823)[4]' = &$heap_436824
((char*)&$heap_436823)[44]' = 0
((char*)&$heap_436823)[48]' = -1
((char*)&$heap_436823)[52]' = -1
((char*)&$heap_436823)[56]' = 0
((char*)&$heap_436823)[8]' = 0
bytes_after(&$heap_436824)' = strlen(&DIRNAME[0]) + 14
$heap_436824' is allocated by malloc
$heap_436824' is allocated
bytes_before(&$heap_436824)' = 0
strlen(&$heap_436824)' = strlen(&DIRNAME[0]) + 13
$heap_436824' is accessed by path name




Change Warning 482.29256 : Leak

Priority:
State:
Finding:
Owner:
Note: