Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Leak  at pvmd.c:4438

Categories: LANG.ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 2477.2505
Procedure: beprime
Trace: View
Modified: Wed Sep 2 12:39:46 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/pvmd.c
   Enter beprime
 4422 beprime() 
 4423 {
 4424         struct htab *htp;
 4425         struct task *tp;
 4426         int i;
 4427  
 4428         runstate = PVMDPRIME;
 4429  
 4430         if ((pvmmyupid = getpid()) == -1) {
 4431                 pvmlogerror("beprime() can't getpid()\n");
 4432                 pvmbailout(0);
 4433         }
 4434  
 4435         myhostpart = 0;
 4436         pvmmytid = TIDPVMD;
 4437  
allocated inside call4438         htp = ht_new(hosts->ht_local);     /* Leak */
     /u1/paul/SATE/2010/c/pvm/pvm3/src/host.c
     Enter beprime / 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 beprime / ht_new
referenced by htp->ht_hosts4439         htp->ht_master = hosts->ht_local;
 4440         htp->ht_local = 0;
 4441         ht_insert(htp, hosts->ht_hosts[hosts->ht_local]);
 4442         ht_insert(htp, hosts->ht_hosts[0]);
     /u1/paul/SATE/2010/c/pvm/pvm3/src/host.c
     Enter beprime / 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 beprime / ht_insert
Preconditions
&$unknown_93940 >= 512
&$unknown_93941 = 0
hosts->ht_local = 1
((char*)&$heap_3798)[8] >= 0
Postconditions
(*hosts->ht_hosts)->hd_ref' = (*hosts->ht_hosts)->hd_ref + 1
$heap_3798' = 0
bytes_after(&$heap_3798)' = 40
$heap_3798' is allocated by malloc
$heap_3798' is allocated
bytes_before(&$heap_3798)' = 0
strlen(&$heap_3798)' = 0
((char*)&$heap_3798)[20]' = 0
((char*)&$heap_3798)[24]' = 0
((char*)&$heap_3798)[32]' = &$unknown_93941
((char*)&$heap_3798)[4]' >= -1
((char*)&$heap_3798)[4]' <= 1
((char*)&$heap_3798)[8]' = ((char*)&$heap_3798)[8] + 1
((char*)&$heap_3798)[12]' = hosts->ht_local
$heap_3799' = 0
bytes_after(&$heap_3799)' = 8 * hosts->ht_local + 8
$heap_3799' is allocated by malloc
$heap_3799' is allocated
bytes_before(&$heap_3799)' = 0
strlen(&$heap_3799)' = 0
hh' = &$unknown_93940
hp' = *hosts->ht_hosts
htp' = &$heap_3798
htp' = &$heap_3798
mask' = 0
myhostpart' = 0
n' = hosts->ht_local + 1
pvmmyupid' != -1
runstate' = 4




Change Warning 2477.2505 : Leak

Priority:
State:
Finding:
Owner:
Note: