From: Steven Luong Date: Fri, 6 May 2022 20:34:10 +0000 (-0700) Subject: vhost: memory leak upon deleting vhost-user interface X-Git-Tag: v22.10-rc0~41 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=fdc17b1ae7743bc37d4e08467d0295d6f277ec12;p=vpp.git vhost: memory leak upon deleting vhost-user interface We allocate vring_spinlock for all vrings in the vui, not just the ones being used. So when we free the vui, we have to free vring_spinlock for all vrings, not just the one being used. Type: fix Signed-off-by: Steven Luong Change-Id: I3951fda71ce6e11474b04302116ea9e08b404758 --- diff --git a/src/vnet/devices/virtio/vhost_user.c b/src/vnet/devices/virtio/vhost_user.c index 9c585722b48..b6e0806db90 100644 --- a/src/vnet/devices/virtio/vhost_user.c +++ b/src/vnet/devices/virtio/vhost_user.c @@ -1414,10 +1414,8 @@ vhost_user_term_if (vhost_user_intf_t * vui) vhost_user_update_gso_interface_count (vui, 0 /* delete */ ); vhost_user_update_iface_state (vui); - FOR_ALL_VHOST_RX_TXQ (q, vui) - { + for (q = 0; q < vec_len (vui->vrings); q++) clib_spinlock_free (&vui->vrings[q].vring_lock); - } if (vui->unix_server_index != ~0) {