Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Leak  at trcmess.c:560

Categories: ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 22164.29187
Procedure: trc_handle_trace_message
Trace: view
Modified: Thu Nov 26 11:35:42 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/trcmess.c
   Enter trc_handle_trace_message
 377 trc_handle_trace_message( ID, src ) 
 378 TRC_ID ID;
 379 int src;
 380 {
 381         TRC_DATADESC DD;
 382  
 383         TRC_TEVDESC TD;
 384  
 385         TRC_TEVTASK TT;
 386  
 387         TRC_HOST H;
   ...
 404         int tusec;
 405         int tsec;
 406         int ecnt;
 407         int eid;
 408         int tid;
 409         int dt;
 410  
 411         int marker;
 412         int nest;
 413  
 414         ecnt = 0;
 415  
 416         TRC_PVMCKERR( pvm_upkint( &marker, 1, 1 ),
 417                 "Unpacking Trace Message", return( ecnt ) );
 418  
 419         /* Old PVM 3.3 Trace Format */ 
 420  
 421         if ( marker > 0 )   /* Uninitialized Variable (ID: 22167.29198) */
 422         {
 423                 tsec = marker;
 424  
 425                 TRC_PVMCKERR( pvm_upkint( &tusec, 1, 1 ),
 426                         "Event Parse Error", return( ecnt ) );
 427  
 428                 TRC_PVMCKERR( pvm_upkint( &tid, 1, 1 ),
 429                         "Event Parse Error", return( ecnt ) );
 430  
 431                 TRC_PVMCKERR( pvm_upkint( &eid, 1, 1 ),
   ...
 433  
 434                 ecnt += trc_store_old_trace_event( ID, tsec, tusec, tid, eid );   /* Uninitialized Variable (ID: 22166.29197) */
 435  
 436                 return( ecnt );
 437         }
 438  
 439         /* New PVM 3.4 Format */ 
 440  
 441         /* Get Task & Host Info */ 
 442  
 443         TT = trc_get_tevtask_tid( ID, src );
 444  
 445         pvmd_tid = pvm_tidtohost( src );
 446  
 447         if ( !pvmd_tid )
 448                 pvmd_tid = pvm_tidtohost( TRC_TID );
 449  
 450         H = trc_get_host_tid( pvmd_tid );
 451  
 452         /* Set Leftover Event Omit Flag */ 
 453  
 454         omit = ( ID->trace_out == NULL 
 455                 || ( TT != NULL && TRC_TASK_OMIT( TT ) ) ) 
 456                         ? TRC_TRUE : TRC_FALSE;
 457  
 458         /* Process Event Message */ 
 459  
 460         nest = 0;
 461  
 462         done = 0;
 463  
 464         do 
 465         {
 466                 switch ( marker ) 
 467                 {
 468                         case TEV_MARK_EVENT_BUFFER: 
 469                         {
 470                                 nest++;
 471  
 472                                 break;
 473                         }
 474  
 475                         case TEV_MARK_EVENT_BUFFER_END: 
 476                         {
   ...
 527                                                 did_done++;
 528                                 }
 529                                 while ( !did_done );
 530  
 531                                 if ( !nest )
 532                                         done++;
 533  
 534                                 break;
 535                         }
 536  
 537                         case TEV_MARK_EVENT_DESC: 
 538                         {
 539                                 TD = trc_create_tevdesc();   /* Leak (ID: 438.29189) */
 540  
 541                                 TD->refcount = 1;
 542  
 543                                 TRC_PVMCKERR( pvm_upkint( &eid, 1, 1 ),
 544                                         "Event Descriptor ID", return( ecnt ) );
 545  
 546                                 TD->eid = eid & ~( TEV_EVENT_ENTRY | TEV_EVENT_EXIT );
 547  
 548                                 if ( eid & TEV_EVENT_ENTRY )
 549                                         TD->entry_exit = TRC_ENTRY_TEV;
 550  
 551                                 else if ( eid & TEV_EVENT_EXIT )
 552                                         TD->entry_exit = TRC_EXIT_TEV;
 553  
 554                                 else 
 555                                         TD->entry_exit = TRC_IGNORE_TEV;
 556  
 557                                 TRC_PVMCKERR( pvm_upkstr( tmp ),
 558                                         "Event Descriptor Name", return( ecnt ) );
 559  
allocated inside call560                                 TD->name = trc_copy_str( tmp );     /* Leak */
     /kat0/fletcher/SATE/2010/pvm3/tracer/trcutil.c
     Enter trc_handle_trace_message / 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: 22160.29169) */  /* 2 more... */
 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 trc_handle_trace_message / trc_copy_str
 561  
referenced by TD->name562                                 desc_done = 0;
 563  
 564                                 do 
 565                                 {
 566                                         TRC_PVMCKERR( pvm_upkint( &did_int, 1, 1 ),
 567                                                 "Semantic Data ID", return( ecnt ) );
 568  
 569                                         if ( did_int != TEV_MARK_EVENT_DESC_END )
 570                                         {
 571                                                 if ( TD->ddesc == NULL )
 572                                                         DD = TD->ddesc = trc_create_datadesc();
 573  
 574                                                 else 
 575                                                         DD = DD->next = trc_create_datadesc();
 576  
 577                                                 if ( H->didlist == NULL )   /* Null Pointer Dereference (ID: 440.29191) */
   ...
 777  
 778                 if ( !done )
 779                 {
 780                         TRC_PVMCKERR( pvm_upkint( &marker, 1, 1 ),
 781                                 "Unpacking Trace Message", return( ecnt ) );
 782                 }
 783         }
 784         while ( !done );
 785  
 786         return( ecnt );
 787 } 
Preconditions
ID->tevtask_list >= 0
ID->trace_out = 0
pvmmytid = -1
pvmrbuf != 0
Postconditions
*stderr' is allocated by fopen
bytes_before(stderr)' = 0
TRC_TMP_CC' <= -1




Change Warning 22164.29187 : Leak

Priority:
State:
Finding:
Owner:
Note: