Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Leak  at ddpro.c:1858

Categories: LANG.ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 2543.2574
Procedure: ht_diff
Trace: View
Modified: Wed Sep 2 12:40:49 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/src/ddpro.c
   Enter ht_diff
 1850 struct htab * 
 1851 ht_diff(htp2, htp1) 
 1852         struct htab *htp2;              /* more */ 
 1853         struct htab *htp1;              /* less */ 
 1854 {
 1855         struct htab *htp;
 1856         int hh;
 1857  
allocated inside call1858         htp = ht_new(1);     /* Leak */
     /u1/paul/SATE/2010/c/pvm/pvm3/src/host.c
     Enter ht_diff / ht_new
 483   struct htab * 
 484   ht_new(siz) 
 485           int siz;                /* initial length of ht_hosts[] */ 
 486   {
 487           struct htab *htp;
 488    
 489           if (siz < 1)
 490                   siz = 1;
 491           htp = TALLOC(1, struct htab, "ht1");
 492           BZERO((char*)htp, sizeof(struct htab));   /* Null Pointer Dereference (ID: 2469.2497) */
 493           htp->ht_last = siz;
referenced by returned value494           htp->ht_hosts = TALLOC(siz + 1, struct hostd*, "ht2");
referenced by htp->ht_hosts495           BZERO((char*)htp->ht_hosts, (siz + 1) * sizeof(struct hostd*));   /* Null Pointer Dereference (ID: 2468.2496) */
 496           return htp;
referenced by ht_new$return->ht_hosts497   } 
     Exit ht_diff / ht_new
referenced by htp->ht_hosts1859         for (hh = htp2->ht_last; hh > 0; hh--)
 1860                 if (htp2->ht_hosts[hh] && !htp2->ht_hosts[hh]->hd_err 
 1861                 && (hh > htp1->ht_last || !htp1->ht_hosts[hh]))
 1862                         ht_insert(htp, htp2->ht_hosts[hh]);
     /u1/paul/SATE/2010/c/pvm/pvm3/src/host.c
     Enter ht_diff / ht_insert
referenced by htp->ht_hosts507   ht_insert(htp, hp) 
 508           struct htab *htp;
 509           struct hostd *hp;
 510   {
 511           int hh;
 512           int i;
 513           unsigned long mask = 0, tmpmask;
 514    
 515           int *dsigs;
 516           int ndsigs;
 517           int found;
 518           int d;
 519    
 520           hh = (hp->hd_hostpart & tidhmask) >> (ffs(tidhmask) - 1);
 521    
 522           /* extend ht_hosts[] if no room */ 
 523    
 524           if (hh > htp->ht_last) {
 525                   int n = htp->ht_last;
 526    
 527                   htp->ht_last = (hh * 3) / 2;
 528                   htp->ht_hosts = TREALLOC(htp->ht_hosts, htp->ht_last + 1, struct hostd*);
referenced by $param_1529                   while (++n <= htp->ht_last)
 530                           htp->ht_hosts[n] = 0;   /* Null Pointer Dereference (ID: 2570.2602) */  /* 6 more... */
 531           }
 532    
 533           /* if already have an entry, take this as an update XXX kind of a hack */ 
 534    
 535           if (htp->ht_hosts[hh]) {        /* already have an entry */ 
 536    
 537                   struct hostd *hp2 = htp->ht_hosts[hh];
 538    
 539                   if (hp->hd_name) {
 540                           if (hp2->hd_name)
 541                                   PVM_FREE(hp2->hd_name);
 542                           hp2->hd_name = STRALLOC(hp->hd_name);   /* Null Pointer Dereference (ID: 2474.2502) */
 543                   }
 544                   if (hp->hd_arch) {
 545                           if (hp2->hd_arch)
 546                                   PVM_FREE(hp2->hd_arch);
 547                           hp2->hd_arch = STRALLOC(hp->hd_arch);   /* Null Pointer Dereference (ID: 2473.2501) */
 548                   }
 549                   hp2->hd_dsig = hp->hd_dsig;
 550                   hp2->hd_mtu = hp->hd_mtu;
 551                   hp2->hd_sad = hp->hd_sad;
 552                   hp2->hd_speed = hp->hd_speed;
 553    
 554           } else {                                        /* add new entry */ 
 555    
 556                   htp->ht_hosts[hh] = hp;
 557                   if (hh)
 558                           htp->ht_cnt++;
 559                   hp->hd_ref++;
 560           }
 561    
 562           /* update number of arches */ 
 563    
leaked564           dsigs = TALLOC( htp->ht_cnt, int, "dsigs");
     Exit ht_diff / ht_insert
Preconditions
&$unknown_477471 >= 512
((char*)$param_1)[4] >= 1
((char*)$param_2)[4] <= ((char*)$param_1)[4] - 1
Postconditions
$unknown_477472' = $unknown_477472 + 1
$heap_31853' = 0
bytes_after(&$heap_31853)' = 40
$heap_31853' is allocated by malloc
$heap_31853' is allocated
bytes_before(&$heap_31853)' = 0
strlen(&$heap_31853)' = 0
((char*)&$heap_31853)[32]' = 0
((char*)&$heap_31853)[4]' >= -1
((char*)&$heap_31853)[4]' <= 1
((char*)&$heap_31853)[8]' = ((char*)&$heap_31853)[8] + 1
$heap_31854' = 0
bytes_after(&$heap_31854)' = 16
$heap_31854' is allocated by malloc
$heap_31854' is allocated
bytes_before(&$heap_31854)' = 0
strlen(&$heap_31854)' = 0
hh' = &$unknown_477471
hh' = ((char*)$param_1)[4]
hp' = &$unknown_477472
htp' = &$heap_31853
htp' = &$heap_31853
htp1' = $param_2
htp2' = $param_1
mask' = 0
n' = 2




Change Warning 2543.2574 : Leak

Priority:
State:
Finding:
Owner:
Note: