In other termination code we have ODP_ERR(). For mostly all things which is called from odp_term_global. But I like current ASSERT() more but it's more easy to debug that code and clean up such things then follow bunch of error debug prints. If no objections I'm going to apply this simple patch.

Maxim.

On 04/02/16 16:52, Bill Fischofer wrote:
Out queues should be empty. Add an assert to verify this to ensure
that memory is not leaked as part of destroy_out_queues(). This addresses
bug https://bugs.linaro.org/show_bug.cgi?id=2089

Signed-off-by: Bill Fischofer <bill.fischo...@linaro.org>
---
Changes for v2:

Switch to ODP_ASSERT() rather than risk looping in the unlikely event that
an output queue is non-empty. This prevents the memory leak while catching
the bug condition that would have resulted in the leak without this check.

  platform/linux-generic/odp_packet_io.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 9192be2..7b1b137 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -296,11 +296,12 @@ static void destroy_in_queues(pktio_entry_t *entry, int 
num)
static void destroy_out_queues(pktio_entry_t *entry, int num)
  {
-       int i;
+       int i, rc;
for (i = 0; i < num; i++) {
                if (entry->s.out_queue[i].queue != ODP_QUEUE_INVALID) {
-                       odp_queue_destroy(entry->s.out_queue[i].queue);
+                       rc = odp_queue_destroy(entry->s.out_queue[i].queue);
+                       ODP_ASSERT(rc == 0);
                        entry->s.out_queue[i].queue = ODP_QUEUE_INVALID;
                }
        }

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to