[PATCH v2 01/16] eal: verify strdup return value

Thomas Monjalon thomas at monjalon.net
Sun Feb 18 14:50:17 CET 2024


21/11/2023 04:44, lihuisong (C):
> 在 2023/11/10 18:01, Chengwen Feng 写道:
> > --- a/lib/eal/linux/eal_dev.c
> > +++ b/lib/eal/linux/eal_dev.c
> > @@ -181,7 +181,10 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
> >   			buf += 14;
> >   			i += 14;
> >   			strlcpy(pci_slot_name, buf, sizeof(subsystem));
> > +			free(event->devname);
> It seems that above free for devname is unnecessary.

You didn't reply to this comment, so I will drop this free call.

> >   			event->devname = strdup(pci_slot_name);
> > +			if (event->devname == NULL)
> > +				return -1;





More information about the dev mailing list