Newer MicroVAX and VAXStations: Avoid error path memory leak

Initialize Coverity flagged uninitialized variable references.  Most/all
of these might never have actually occurred with reasonable
packet buffer descripter lists, but zero initialized values will never
hurt.
This commit is contained in:
Mark Pizzolato 2019-10-20 23:05:27 -07:00
parent 0ca1fe4e40
commit 3d09cd2d7f

View file

@ -304,7 +304,7 @@ void xs_process_receive(CTLR* xs)
{ {
uint8 b0, b1, b2, b3; uint8 b0, b1, b2, b3;
uint32 segb, ba; uint32 segb, ba;
int slen, wlen, off; int slen, wlen, off = 0;
t_stat rstatus, wstatus; t_stat rstatus, wstatus;
ETH_ITEM* item = 0; ETH_ITEM* item = 0;
int no_buffers = xs->var->csr0 & CSR0_MISS; int no_buffers = xs->var->csr0 & CSR0_MISS;
@ -458,6 +458,7 @@ t_stat rstatus, wstatus;
/* sim_debug(DBG_TRC, xs->dev, "xs_process_transmit()\n"); */ /* sim_debug(DBG_TRC, xs->dev, "xs_process_transmit()\n"); */
off = giant = runt = 0;
for (;;) { for (;;) {
/* get next transmit buffer */ /* get next transmit buffer */
@ -734,8 +735,10 @@ if (tptr == NULL)
strcpy(tptr, cptr); strcpy(tptr, cptr);
xs->var->etherface = (ETH_DEV *) malloc(sizeof(ETH_DEV)); xs->var->etherface = (ETH_DEV *) malloc(sizeof(ETH_DEV));
if (!xs->var->etherface) if (!xs->var->etherface) {
free(tptr);
return SCPE_MEM; return SCPE_MEM;
}
status = eth_open(xs->var->etherface, cptr, xs->dev, DBG_ETH); status = eth_open(xs->var->etherface, cptr, xs->dev, DBG_ETH);
if (status != SCPE_OK) { if (status != SCPE_OK) {