Fix memory leaks in attach error paths.
This commit is contained in:
parent
2fcb0aad62
commit
e0fbfa6abf
2 changed files with 9 additions and 1 deletions
|
@ -2611,6 +2611,7 @@ t_stat xq_attach(UNIT* uptr, char* cptr)
|
||||||
printf("%s: MAC Address Conflict on LAN for address %s, change the MAC address to a unique value\n", xq->dev->name, buf);
|
printf("%s: MAC Address Conflict on LAN for address %s, change the MAC address to a unique value\n", xq->dev->name, buf);
|
||||||
if (sim_log) fprintf (sim_log, "%s: MAC Address Conflict on LAN for address %s, change the MAC address to a unique value\n", xq->dev->name, buf);
|
if (sim_log) fprintf (sim_log, "%s: MAC Address Conflict on LAN for address %s, change the MAC address to a unique value\n", xq->dev->name, buf);
|
||||||
eth_close(xq->var->etherface);
|
eth_close(xq->var->etherface);
|
||||||
|
free(tptr);
|
||||||
free(xq->var->etherface);
|
free(xq->var->etherface);
|
||||||
xq->var->etherface = NULL;
|
xq->var->etherface = NULL;
|
||||||
return SCPE_NOATT;
|
return SCPE_NOATT;
|
||||||
|
@ -2623,8 +2624,13 @@ t_stat xq_attach(UNIT* uptr, char* cptr)
|
||||||
|
|
||||||
/* init read queue (first time only) */
|
/* init read queue (first time only) */
|
||||||
status = ethq_init(&xq->var->ReadQ, XQ_QUE_MAX);
|
status = ethq_init(&xq->var->ReadQ, XQ_QUE_MAX);
|
||||||
if (status != SCPE_OK)
|
if (status != SCPE_OK) {
|
||||||
|
eth_close(xq->var->etherface);
|
||||||
|
free(tptr);
|
||||||
|
free(xq->var->etherface);
|
||||||
|
xq->var->etherface = NULL;
|
||||||
return status;
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
if (xq->var->mode == XQ_T_DELQA_PLUS)
|
if (xq->var->mode == XQ_T_DELQA_PLUS)
|
||||||
eth_filter_hash (xq->var->etherface, 1, &xq->var->init.phys, 0, xq->var->init.mode & XQ_IN_MO_PRO, &xq->var->init.hash_filter);
|
eth_filter_hash (xq->var->etherface, 1, &xq->var->init.phys, 0, xq->var->init.mode & XQ_IN_MO_PRO, &xq->var->init.hash_filter);
|
||||||
|
|
|
@ -1587,6 +1587,8 @@ t_stat xu_attach(UNIT* uptr, char* cptr)
|
||||||
printf("%s: MAC Address Conflict on LAN for address %s\n", xu->dev->name, buf);
|
printf("%s: MAC Address Conflict on LAN for address %s\n", xu->dev->name, buf);
|
||||||
if (sim_log) fprintf (sim_log, "%s: MAC Address Conflict on LAN for address %s\n", xu->dev->name, buf);
|
if (sim_log) fprintf (sim_log, "%s: MAC Address Conflict on LAN for address %s\n", xu->dev->name, buf);
|
||||||
eth_close(xu->var->etherface);
|
eth_close(xu->var->etherface);
|
||||||
|
free(tptr);
|
||||||
|
xu->var->etherface = 0;
|
||||||
return SCPE_NOATT;
|
return SCPE_NOATT;
|
||||||
}
|
}
|
||||||
uptr->filename = tptr;
|
uptr->filename = tptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue