Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Leak  at pvmgs_func.c:749

Categories: ALLOC.LEAK CWE:401 CWE:771 CWE:773
Warning ID: 556.29350
Procedure: gs_tidlist
Trace: view
Modified: Thu Nov 26 11:38:39 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/pvmgs/pvmgs_func.c
   Enter gs_tidlist
 719 gs_tidlist(gname, holes_not_allowed, hash_list, ngroups, gstate) 
 720 char *gname;
 721 int holes_not_allowed;
 722 GROUP_LIST_PTR hash_list;
 723 int *ngroups, *gstate;
 724 {
 725         int i;
 726         int cnt;
 727         int gi;  
 728         int hole_exists = 0;
 729         int ntids;  
 730         int *tids;  
 731  
 732         GROUP_STRUCT_PTR group;
 733  
 734         *gstate = DYNAMIC;
 735  
 736         /* check for valid group name */ 
 737         if (gname == (char*) 0 || *gname == '\0')
 738                 return(PvmNullGroup);
 739  
 740         group = gs_group(gname, hash_list, ngroups, NOCREATE);
 741         if (group == (GROUP_STRUCT_PTR) NULL)
 742                 return(PvmNoGroup);
 743  
 744         if (group->staticgroup == STATICDEAD) /* no collectives allowed on */ 
 745                 return(PvmNoGroup);               /* a dead static group       */ 
 746  
 747         ntids = group->ntids;
 748  
referenced by returned value749         if ( (tids = (int *) PVM_ALLOC(group->ntids * sizeof(int), "gs_tidlist()"))     /* Leak */
referenced by tids750                         == (int *) NULL )  
 751                 return (PvmNoMem);
 752  
 753         for (i  = 0, cnt = 0; i < group->maxntids; i++)
 754         {
 755                 if (group->tids[i] != -1)
 756                         tids[cnt++] = group->tids[i];
 757                 else 
 758                         if (i < ntids) hole_exists = 1;
 759                                 if (cnt > ntids) break;  /* don't want to overwrite mem  */ 
 760         }
 761          
 762         if (cnt != ntids)
 763         {
 764                 fprintf(stderr, "gs_tidlist: cnt (%d) != ntids (%d) \n", cnt,  
 765                                 group->ntids);
 766                 return(PvmSysErr);
 767         }
 768          
 769         if (holes_not_allowed && hole_exists) /* detected missing inst #s  */ 
 770                 return(PvmNoInst); /* scatter and gather require no holes      */ 
 771  
 772         pvm_initsend(PvmDataDefault); /* pack 'em up                       */ 
 773         pvm_pkint(&ntids, 1, 1);
 774         pvm_pkint(tids,  cnt, 1);
 775         PVM_FREE(tids);
 776  
 777         if (group->staticgroup == STATIC)
 778                 *gstate = STATIC;
 779  
 780         return (PvmOk);
 781 }   
Preconditions
*gname != 0
strlen(gname) != 0
Postconditions
*stderr' is allocated by fopen
bytes_before(stderr)' = 0




Change Warning 556.29350 : Leak

Priority:
State:
Finding:
Owner:
Note: