mirror of
https://github.com/open-simh/simh.git
synced 2026-01-14 07:40:35 +00:00
Fix potential memory leak in error path reported by Michael Bloom
This commit is contained in:
parent
cf280ad8f7
commit
663b25818b
@ -2582,7 +2582,10 @@ t_stat xq_attach(UNIT* uptr, char* cptr)
|
||||
strcpy(tptr, cptr);
|
||||
|
||||
xq->var->etherface = (ETH_DEV *) malloc(sizeof(ETH_DEV));
|
||||
if (!xq->var->etherface) return SCPE_MEM;
|
||||
if (!xq->var->etherface) {
|
||||
free(tptr);
|
||||
return SCPE_MEM;
|
||||
}
|
||||
|
||||
status = eth_open(xq->var->etherface, cptr, xq->dev, DBG_ETH);
|
||||
if (status != SCPE_OK) {
|
||||
|
||||
@ -1571,7 +1571,10 @@ t_stat xu_attach(UNIT* uptr, char* cptr)
|
||||
strcpy(tptr, cptr);
|
||||
|
||||
xu->var->etherface = (ETH_DEV *) malloc(sizeof(ETH_DEV));
|
||||
if (!xu->var->etherface) return SCPE_MEM;
|
||||
if (!xu->var->etherface) {
|
||||
free(tptr);
|
||||
return SCPE_MEM;
|
||||
}
|
||||
|
||||
status = eth_open(xu->var->etherface, cptr, xu->dev, DBG_ETH);
|
||||
if (status != SCPE_OK) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user