Text  |   XML   |   Visible Warnings:

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

Categories: ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 479.29253
Procedure: verify_fp
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 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 ( !strcmp( TF->fpbuf->rwstr, rwstr ) )
 941                 {
 942                         /* Move to Top of List */ 
 943  
 944                         if ( FPS != TF->fpbuf )
 945                         {
 946                                 if ( FPS == NULL )
 947                                 {
 948                                         printf( "Warning:  Empty File Ptr Buffer List\n" );
 949  
 950                                         return( TRC_TRUE );
   ...
 970  
 971                                 printf( 
 972                                         "Warning:  Verify File Ptr Buffer Not Found\n" );
 973                         }
 974  
 975                         return( TRC_TRUE );
 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  
 1009         FPB = create_fpbuf();   /* Leak (ID: 481.29255) */
 1010  
 1011         if ( !strcmp( rwstr, "w" ) )
 1012         {
 1013                 fd = open( TF->fname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600 );   /* Leak (ID: 480.29254) */
 1014  
 1015                 if ( !trc_fdcheck( fd, TF->fname ) )
 1016                         return( TRC_FALSE );
 1017  
 1018                 FPB->fp = fdopen( fd, rwstr );
 1019         }
 1020  
 1021         else if ( !strcmp( rwstr, "a" ) )
 1022         {
referenced by returned value1023                 fd = open( TF->fname,
 1024                                 O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC, 0600 );     /* Leak */
 1025  
referenced by fd1026                 if ( !trc_fdcheck( fd, TF->fname ) )
 1027                         return( TRC_FALSE );
 1028  
 1029                 FPB->fp = fdopen( fd, rwstr );
 1030         }
 1031  
 1032         else 
 1033                 FPB->fp = fopen( TF->fname, rwstr );
 1034  
 1035         if ( !trc_filecheck( FPB->fp, TF->fname ) )
 1036         {
 1037                 free_fpbuf( &FPB );
 1038  
 1039                 return( TRC_FALSE );
 1040         }
 1041  
 1042         else 
 1043         {
 1044                 /* Add File Ptr Buffer to List */ 
 1045  
 1046                 FPB->rwstr = rwstr;
 1047  
 1048                 FPB->tmpfile = TF;
 1049                 TF->fpbuf = FPB;
   ...
 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
*rwstr = 97
strlen(rwstr) = 1
vflag != 0
Postconditions
*stderr' is allocated by fopen
bytes_before(stderr)' = 0
*stdout' is allocated by fopen
bytes_before(stdout)' = 0
NFPS' <= 9
errno' != 0




Change Warning 479.29253 : Leak

Priority:
State:
Finding:
Owner:
Note: