Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Leak  at trcsort.c:786

Categories: LANG.ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 2970.3055
Procedure: get_tmpfile
Trace: View
Modified: Wed Sep 2 12:55:17 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
   /u1/paul/SATE/2010/c/pvm/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                 sprintffname, "%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 */
     /u1/paul/SATE/2010/c/pvm/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: 2853.2916) */  /* Uninitialized Variable (ID: 2862.2927) */
 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
$param_3 != 0
NFPS <= 9
TMPF = 0
vflag = 0
Postconditions
errno' != 0
$heap_260526' = 0
bytes_after(&$heap_260526)' = 112
$heap_260526' is allocated by malloc
$heap_260526' is freed
bytes_before(&$heap_260526)' = 0
((char*)&$heap_260526)[16]' = 0
((char*)&$heap_260526)[32]' = 0
((char*)&$heap_260526)[40]' = $param_1
((char*)&$heap_260526)[48]' = -1
((char*)&$heap_260526)[56]' = -1
((char*)&$heap_260526)[64]' = -1
((char*)&$heap_260526)[72]' = -1
((char*)&$heap_260526)[80]' = 0
((char*)&$heap_260526)[8]' = &$heap_260527
((char*)&$heap_260526)[88]' = 0
((char*)&$heap_260526)[96]' = -1
((char*)&$heap_260526)[100]' = -1
((char*)&$heap_260526)[104]' = 0
$heap_260527' is allocated by malloc
$heap_260527' is allocated
bytes_before(&$heap_260527)' = 0
$heap_260527' is opened




Change Warning 2970.3055 : Leak

Priority:
State:
Finding:
Owner:
Note: