Text  |   XML   |   Visible Warnings:

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

Categories: LANG.ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 2969.3054
Procedure: verify_fp
Trace: View
Modified: Wed Sep 2 12:55:16 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 verify_fp
 924 verify_fp( TF, rwstr ) 
 925 TMPFILE TF;
 926 char *rwstr;
 927 {
 928         FPBUF FPBlast;
 929         FPBUF FPBptr;
 930         FPBUF FPB;
 931  
 932         int fd;
 933  
 934         /* File Ptr Buffer Already There */ 
 935  
 936         if ( TF->fpbuf )
 937         {
 938                 /* Verify Same Mode */ 
 939  
 940                 if ( !strcmpTF->fpbuf->rwstr, rwstr ) )
 941                 {
 942                         /* Move to Top of List */ 
 943  
 944                         if ( FPS != TF->fpbuf )
 945                         {
 946                                 if ( FPS == NULL )
   ...
 976                 }
 977  
 978                 /* Switching File Modes, Close File Ptr */ 
 979  
 980                 else 
 981                         close_fp( TF );
 982         }
 983  
 984         /* Check for Flush */ 
 985  
 986         if ( NFPS >= MAX_OPEN_FP )
 987         {
 988                 FPBptr = FPS;
 989  
 990                 FPBlast = (FPBUF) NULL;
 991  
 992                 while ( FPBptr->next != NULL )
 993                 {
 994                         FPBlast = FPBptr;
 995                         FPBptr = FPBptr->next;
 996                 }
   ...
 999                         free_fpbuf( &(FPBlast->next);
 1000  
 1001                 else 
 1002                         free_fpbuf( &(FPS);
 1003  
 1004                 NFPS--;
 1005         }
 1006  
 1007         /* Create New File Ptr Buffer */ 
 1008  
allocated inside call1009         FPB = create_fpbuf();     /* Leak */
     Enter verify_fp / create_fpbuf
 858   create_fpbuf() 
 859   {
 860           FPBUF tmp;
 861    
referenced by returned value862           tmp = (FPBUF) malloc( sizeof( struct fp_buffer_struct ) );
referenced by tmp863           trc_memcheck( tmp, "File Buffer Structure" );
 864    
 865           tmp->fp = (FILE *) NULL;
 866    
 867           tmp->rwstr = (char *) NULL;
 868    
 869           tmp->tmpfile = (TMPFILE) NULL;
 870    
 871           tmp->next = (FPBUF) NULL;
 872    
 873           if ( vflag )
 874                   { printf( "+" ); fflushstdout ); }
 875    
 876           return( tmp );
referenced by returned value877   } 
     Exit verify_fp / create_fpbuf
 1010  
referenced by FPB1011         if ( !strcmp( rwstr, "w" ) )
 1012         {
 1013                 fd = open( TF->fname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600 );   /* Leak (ID: 2968.3053) */
 1014  
 1015                 if ( !trc_fdcheck( fd, TF->fname ) )
 1016                         return( TRC_FALSE );
 1017  
 1018                 FPB->fp = fdopenfd, rwstr );
 1019         }
 1020  
 1021         else if ( !strcmprwstr, "a" ) )
 1022         {
 1023                 fd = openTF->fname,
 1024                                 O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC, 0600 );   /* Leak (ID: 2967.3052) */
 1025  
 1026                 if ( !trc_fdcheck( fd, TF->fname ) )
   ...
 1061                         {
 1062                                 printf( "\nError in fseek() of Temp File\n\n" );
 1063                                 bail();
 1064                         }
 1065                 }
 1066  
 1067                 /* Success */ 
 1068  
 1069                 return( TRC_TRUE );
 1070         }
 1071 } 
Preconditions
*$param_1 = 0
strlen($param_2) = 1
NFPS <= 9
vflag = 0
Postconditions
errno' != 0




Change Warning 2969.3054 : Leak

Priority:
State:
Finding:
Owner:
Note: