Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Free Null Pointer  at ddpro.c:2102

Categories: ALLOC.FNP CWE:590
Warning ID: 148.28771
Procedure: startack
Trace: view
Modified: Thu Nov 26 11:27:50 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/src/ddpro.c
   Enter startack
 2056 startack(wp, mp) 
 2057         struct waitc *wp;               /* wait context on hoster */ 
 2058         struct pmsg *mp;
 2059 {
 2060         struct hostd *hp;
 2061         struct pmsg *mp2;
 2062         struct waitc *wp2;              /* seed waitc for htupd peer group */ 
 2063         struct waitc *wp3;
 2064         int count;                              /* num of new hosts */ 
 2065         int happy;                              /* num of happy new hosts */ 
 2066         struct waitc_add *wxp;
   ...
 2070         int i, j;
 2071         int t;
 2072         int hh;
 2073         char *buf;
 2074         char buf2[256];
 2075  
 2076         /*
 2077         * unpack startup results, update hosts in wait context 
 2078         */ 
 2079  
 2080         wxp = (struct waitc_add *)wp->wa_spec;
 2081         count = wxp->w_num;
 2082         upkint(mp, &j);
 2083  
 2084         while (j-- > 0) {
true2085                 if (upkuint(mp, &t) || upkstralloc(mp, &buf)) {
 2086                         pvmlogerror("startack() bad message format\n");
 2087                         pkint(wp->wa_mesg, PvmDSysErr);
 2088                         sendmessage(wp->wa_mesg);
 2089                         wp->wa_mesg = 0;
 2090                         wait_delete(wp);
 2091                         busyadding = 0;
 2092                         return 0;
 2093                 }
 2094                 for (i = count; i-- > 0 && wxp->w_hosts[i]->hd_hostpart != t; ) ;
 2095                 if (i < 0) {
 2096                         pvmlogprintf("startack() what? some random tid %x\n", t);
 2097                         pkint(wp->wa_mesg, PvmDSysErr);
 2098                         sendmessage(wp->wa_mesg);
 2099                         wp->wa_mesg = 0;
 2100                         wait_delete(wp);
 2101                         busyadding = 0;
buf <= 40952102                         PVM_FREE(buf);     /* Free Null Pointer */
 2103                         return 0;
 2104                 }
 2105                 hp = wxp->w_hosts[i];
 2106                 ac = sizeof(av)/sizeof(av[0]);
 2107                 if (crunchzap(buf, &ac, av) || ac != 5) {
 2108                         pvmlogprintf("startack() host %s expected version, got \"%s\"\n",
 2109                                         hp->hd_name, buf);
 2110                         if (!(hp->hd_err = errnamecode(buf)))
 2111                                 hp->hd_err = PvmCantStart;
 2112                         PVM_FREE(buf);
 2113                         continue;
 2114                 }
 2115  
 2116                 ver = atoi(av[0]);
 2117                 if (ver != DDPROTOCOL) {
 2118                         pvmlogprintf( 
 2119                                         "slave_exec() host %s d-d protocol mismatch (%d/%d)\n",
 2120                                         hp->hd_name, ver, DDPROTOCOL);
 2121                         hp->hd_err = PvmBadVersion;
 2122                         continue;
 2123                 }
 2124  
 2125                 hp->hd_arch = STRALLOC(av[1]);   /* Null Pointer Dereference (ID: 22061.28770) */
 2126                 hex_inadport(av[2], &hp->hd_sad);
 2127                 hp->hd_mtu = atoi(av[3]);
 2128                 hp->hd_dsig = atoi(av[4]);
 2129  
 2130                 PVM_FREE(buf);
Preconditions
&$unknown_551355 >= 2
wp->wa_peer >= 0
wp->wa_mesg = &freepmsgs.m_link
wp->wa_link >= 0
*wp->wa_spec >= 1
numpmsgs != -1
Postconditions
buf' = 0
busyadding' = 0
count' = *wp->wa_spec
freepmsgs.m_rlink' = wp->wa_mesg
i' = -1
j' = &$unknown_551355 - 2
numpmsgs' = numpmsgs + 2
wxp' = wp->wa_spec




Change Warning 148.28771 : Free Null Pointer

Priority:
State:
Finding:
Owner:
Note: