From: Matias Elo <[email protected]> Previously the implementation would use wrong handles and crash if CONFIG_PACKET_MAX_SEGS was set to one. https://bugs.linaro.org/show_bug.cgi?id=3013
Signed-off-by: Matias Elo <[email protected]> Reviewed-and-tested-by: Bill Fischofer <[email protected]> Signed-off-by: Maxim Uvarov <[email protected]> --- /** Email created from pull request 50 (nagarahalli:api-next-travis) ** https://github.com/Linaro/odp/pull/50 ** Patch: https://github.com/Linaro/odp/pull/50.patch ** Base sha: 4f97e500a097928e308a415c32a88465adc5f5cc ** Merge commit sha: 95322c7b65a45928baf62cc6dd993c3a3bcdfe3a **/ platform/linux-generic/odp_packet.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 6799c6ef..01a82854 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -581,11 +581,16 @@ void odp_packet_free(odp_packet_t pkt) void odp_packet_free_multi(const odp_packet_t pkt[], int num) { + odp_buffer_t buf[num * CONFIG_PACKET_MAX_SEGS]; + int i; + if (CONFIG_PACKET_MAX_SEGS == 1) { - buffer_free_multi((const odp_buffer_t * const)pkt, num); + for (i = 0; i < num; i++) + buf[i] = buffer_handle(packet_hdr(pkt[i])); + + buffer_free_multi(buf, num); } else { - odp_buffer_t buf[num * CONFIG_PACKET_MAX_SEGS]; - int i, j; + int j; int bufs = 0; for (i = 0; i < num; i++) {
