Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Leak  at trcfile.c:1371

Categories: LANG.ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 2850.2913
Procedure: trc_store_trace_event
Trace: View
Modified: Wed Sep 2 12:50:09 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/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 
 1039                                 && DD->dt != TEV_DATA_STRING )
 1040                         {
 1041                                 if ( !omit )
 1042                                         printf( "Error: Unpack Size %d Too Large\n", num );
 1043  
 1044                                 return( TRC_FALSE );
 1045                         }
 1046  
 1047                         if ( !omit )
 1048                         {
 1049                                 if ( DD->dt == TEV_DATA_CPLX 
 1050                                         || DD->dt == TEV_DATA_DCPLX )
 1051                                 {
 1052                                         fprintfID->trace_out, "[%d] { ", num * 2 );
 1053                                         /* matching } */ 
 1054                                 }
 1055  
 1056                                 else if ( DD->dt == TEV_DATA_STRING )
 1057                                         fprintf( ID->trace_out, "[%d] ", num );
 1058  
 1059                                 else if ( DD->dt == TEV_DATA_BYTE )
 1060                                 {
 1061                                         fprintfID->trace_out, "[%d] { ", num + 1 );
 1062                                         /* matching } */ 
 1063                                 }
 1064  
 1065                                 else 
 1066                                 {
 1067                                         fprintfID->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_NULLbreak;
 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                                         fprintfID->trace_out, "%u", upk_short[i] );
 1357  
 1358                                         if ( i < num - 1 )
 1359                                                 fprintfID->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 */
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 = strlenupk_str )) > maxlen )
 1382                                                 maxlen = len;
 1383  
 1384                                         strarr[i] = trc_copy_str( upk_str );
 1385                                 }
 1386  
 1387                                 if ( !omit && newtask 
 1388                                         && !strcmpDD->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
$param_4 = 0
((char*)$param_1)[80] >= 0
((char*)$param_2)[16] <= -1
((char*)$param_2)[24] != 0
((char*)&((char*)*$param_2)[32])[8] = 12
((char*)&((char*)*$param_2)[32])[12] = 128
strlen(*$param_2) != 0
pvmmytid = -1
pvmrbuf != 0
Postconditions
TRC_TMP_CC' <= -1




Change Warning 2850.2913 : Leak

Priority:
State:
Finding:
Owner:
Note: