deal with malloc failure when setting up the multicast filter
Noticed by: Coverity Prevent analysis tool
This commit is contained in:
parent
af5691cdd5
commit
52c94c38dc
@ -1626,6 +1626,10 @@ ti_setmulti(sc)
|
|||||||
if (ifma->ifma_addr->sa_family != AF_LINK)
|
if (ifma->ifma_addr->sa_family != AF_LINK)
|
||||||
continue;
|
continue;
|
||||||
mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT);
|
mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT);
|
||||||
|
if (mc == NULL) {
|
||||||
|
if_printf(ifp, "no memory for mcast filter entry\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
|
bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
|
||||||
(char *)&mc->mc_addr, ETHER_ADDR_LEN);
|
(char *)&mc->mc_addr, ETHER_ADDR_LEN);
|
||||||
SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries);
|
SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries);
|
||||||
|
@ -1626,6 +1626,10 @@ ti_setmulti(sc)
|
|||||||
if (ifma->ifma_addr->sa_family != AF_LINK)
|
if (ifma->ifma_addr->sa_family != AF_LINK)
|
||||||
continue;
|
continue;
|
||||||
mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT);
|
mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT);
|
||||||
|
if (mc == NULL) {
|
||||||
|
if_printf(ifp, "no memory for mcast filter entry\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
|
bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
|
||||||
(char *)&mc->mc_addr, ETHER_ADDR_LEN);
|
(char *)&mc->mc_addr, ETHER_ADDR_LEN);
|
||||||
SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries);
|
SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user