diff --git a/PDP11/pdp11_xq.c b/PDP11/pdp11_xq.c index f3b3ce1f..e9a05ae4 100644 --- a/PDP11/pdp11_xq.c +++ b/PDP11/pdp11_xq.c @@ -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) { diff --git a/PDP11/pdp11_xu.c b/PDP11/pdp11_xu.c index 05bccaed..28dc50e0 100644 --- a/PDP11/pdp11_xu.c +++ b/PDP11/pdp11_xu.c @@ -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) {