Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Leak  at trcfile.c:1371

Categories: ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 22156.29165
Procedure: trc_store_trace_event
Trace: view
Modified: Thu Nov 26 11:35: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/trcfile.c
   Enter trc_store_trace_event
 964 trc_store_trace_event( ID, TD, tid, omit ) 
 965 TRC_ID ID;
 966 TRC_TEVDESC TD;
 967 int tid;
 968 int omit;
 969 {
 970         TRC_DATADESC DD;
 971  
 972         TRC_TEVTASK TT;
 973  
 974         char    upk_byte[TRC_MAX_UNPACK_ARR_SIZE];
   ...
 989         int maxlen;
 990         int ignore;
 991         int tusec;
 992         int tsec;
 993         int len;
 994         int num;
 995         int i;
 996  
 997         /* Dump Descriptor (if necessary) */ 
 998  
 999         if ( !omit && TD->dump )
 1000                 trc_dump_tevdesc( ID, TD, tid );
 1001  
 1002         /* Set New Task Flag */ 
 1003  
 1004         TT = (TRC_TEVTASK) NULL;
 1005  
 1006         tsec = tusec = -1;
 1007  
 1008         newtask = TRC_FALSE;
 1009         endtask = TRC_FALSE;
 1010  
 1011         if ( !strcmp( TD->name, "newtask" ) 
 1012                 || !strcmp( TD->name, "spntask" ) )
 1013         {
 1014                 newtask = TRC_TRUE;
 1015         }
 1016  
 1017         else if ( !strcmp( TD->name, "endtask" ) )
 1018                 endtask = TRC_TRUE;
 1019  
 1020         ignore = TRC_FALSE;
 1021  
 1022         /* Store Event Header */ 
 1023  
 1024         if ( !omit )
 1025                 trc_store_event_header( ID, TD, tid );
 1026  
 1027         /* Store Remainder of Event */ 
 1028  
 1029         DD = TD->ddesc;
 1030  
 1031         while ( DD != NULL )
 1032         {
 1033                 if ( DD->array == TEV_DATA_ARRAY )
 1034                 {
 1035                         TRC_PVMCKERR( pvm_upkint( &num, 1, 1 ),
 1036                                 "Array Unpack", return( TRC_FALSE ) );
 1037  
 1038                         if ( num > TRC_MAX_UNPACK_ARR_SIZE   /* Uninitialized Variable (ID: 22163.29172) */
 1039                                 && DD->dt != TEV_DATA_STRING )
 1040                         {
 1041                                 if ( !omit )
 1042                                         printf( "Error: Unpack Size %d Too Large\n", num );
 1043  
   ...
 1063                                 }
 1064  
 1065                                 else 
 1066                                 {
 1067                                         fprintf( ID->trace_out, "[%d] { ", num );
 1068                                         /* matching } */ 
 1069                                 }
 1070                         }
 1071                 }
 1072  
 1073                 else 
 1074                         num = 1;
 1075  
 1076                 switch ( DD->dt ) 
 1077                 {
 1078                         case TEV_DATA_NULL: break;
 1079  
 1080                         case TEV_DATA_BYTE: 
 1081                         {
 1082                                 TRC_PVMCKERR( pvm_upkbyte( upk_byte, num, 1 ),
 1083                                         "Event BYTE Unpack", return( TRC_FALSE ) );
 1084  
 1085                                 if ( omit )
 1086                                         break;
   ...
 1355                                 {
 1356                                         fprintf( ID->trace_out, "%u", upk_short[i] );
 1357  
 1358                                         if ( i < num - 1 )
 1359                                                 fprintf( ID->trace_out, ", " );
 1360                                 }
 1361  
 1362                                 break;
 1363                         }
 1364  
 1365                         case TEV_DATA_STRING: 
 1366                         {
 1367                                 if ( num < 1 )
 1368                                         break;
 1369  
referenced by returned value1370                                 strarr = (char **) malloc( (unsigned) num 
 1371                                                 * sizeof(char *) );     /* Leak */  /* Integer Overflow of Allocation Size (ID: 22158.29167) */
referenced by strarr1372                                 trc_memcheck( strarr, "String Array" );
 1373  
 1374                                 maxlen = 0;
 1375  
 1376                                 for ( i=0 ; i < num ; i++ )
 1377                                 {
 1378                                         TRC_PVMCKERR( pvm_upkstr( upk_str ),
 1379                                                 "Event STRING Unpack", return( TRC_FALSE ) );
 1380  
 1381                                         if ( (len = strlen( upk_str )) > maxlen )   /* Uninitialized Variable (ID: 22162.29171) */
 1382                                                 maxlen = len;
 1383  
 1384                                         strarr[i] = trc_copy_str( upk_str );
 1385                                 }
 1386  
 1387                                 if ( !omit && newtask 
 1388                                         && !strcmp( DD->did->name, "TN" ) )
 1389                                 {
   ...
 1482                 }
 1483  
 1484                 if ( tsec != -1 && tusec != -1 )
 1485                         trc_update_trace_time( tsec, tusec );
 1486  
 1487                 return( TRC_TRUE );
 1488         }
 1489  
 1490         else 
 1491                 return( TRC_FALSE );
 1492 } 
Preconditions
omit != 0
TD->ddesc->dt = 12
TD->ddesc->array != 128
*TD->name = 110
strlen(*TD) = 7
pvmmytid = -1
pvmrbuf != 0
Postconditions
*stderr' is allocated by fopen
bytes_before(stderr)' = 0
TRC_TMP_CC' <= -1




Change Warning 22156.29165 : Leak

Priority:
State:
Finding:
Owner:
Note: