2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

netdev-dpdk: Fix possible memory leak in vhost stats.

On error condition need to release the allocated structs.

Reported by Coverity.

Fixes: 3b29286db1c5 ("netdev-dpdk: Add per virtqueue statistics.")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
This commit is contained in:
Roi Dayan 2025-05-22 13:48:15 +03:00 committed by Kevin Traynor
parent 7e3a0b4961
commit b42f9fde4a

View File

@ -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;
}