[dpdk-dev] [PATCH 4/6] examples/ntb: enable an example for ntb

Li, Xiaoyun xiaoyun.li at intel.com
Wed Jun 5 10:32:50 CEST 2019


Hi
> > I noticed that there are two allocations, one for pkts_recv[0] and another for
> > pkts_recv[0]->buf_addr, How about we declare
> >
> > 	struct rte_rawdev_buf pkts_recv[1];
> >
> > and allocate memory for its buf_addr
> >
> > 	pkts_recv[0].buf_addr = malloc(size);
> >
> > then we call
> >
> > 	rte_rawdev_dequeue_buffers(dev_id, &pkts_recv, 1, (void *)size);
> >
> > After that, we just need to free once.
> >
> > 	free(pkts_recv[0].buf_addr);
> >

Double pointer does not represent 2D arrays. Please refer to
https://stackoverflow.com/questions/4470950/why-cant-we-use-double-pointer-to-represent-two-dimensional-arrays

It will cause segment fault in enqueue/dequeue.

I will free twice.

> > >2.17.1
> > >


More information about the dev mailing list