examples/kni: fix crash on exit
authorHyun Yoo <easetheworld@gmail.com>
Wed, 5 Aug 2015 21:58:04 +0000 (14:58 -0700)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 10 Aug 2015 14:25:30 +0000 (16:25 +0200)
In kni_free_kni(), p[i] should be p[port_id].

Signed-off-by: Hyun Yoo <easetheworld@gmail.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
examples/kni/main.c

index 6f74d8e..6d434ad 100644 (file)
@@ -830,9 +830,9 @@ kni_free_kni(uint8_t port_id)
        if (port_id >= RTE_MAX_ETHPORTS || !p[port_id])
                return -1;
 
-       for (i = 0; i < p[i]->nb_kni; i++) {
-               rte_kni_release(p[i]->kni[i]);
-               p[i]->kni[i] = NULL;
+       for (i = 0; i < p[port_id]->nb_kni; i++) {
+               rte_kni_release(p[port_id]->kni[i]);
+               p[port_id]->kni[i] = NULL;
        }
        rte_eth_dev_stop(port_id);