Reported by Coverity.
On error flow need to release the allocated structs.

Fixes: 3b29286db1c5 ("netdev-dpdk: Add per virtqueue statistics.")
Signed-off-by: Roi Dayan <r...@nvidia.com>
---
 lib/netdev-dpdk.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index e2708a8a5753..c191bfed38c4 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -3785,15 +3785,12 @@ netdev_dpdk_vhost_get_custom_stats(const struct netdev 
*netdev,
         stat_offset += vhost_txq_stats_count;
     }
 
-    free(vhost_stats_names);
-    vhost_stats_names = NULL;
-    free(vhost_stats);
-    vhost_stats = NULL;
-
 out:
     ovs_mutex_unlock(&dev->mutex);
 
     custom_stats->size = stat_offset;
+    free(vhost_stats_names);
+    free(vhost_stats);
 
     return 0;
 }
-- 
2.21.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to