When the return value check for pthread_mutex_init() was removed the
out_free label and vhost_user_socket_mem_free() were removed.

The free is still needed as vsocket was not being freed on out_mutex
error path.

Restore vhost_user_socket_mem_free() on error path.

Fixes: 4d2aa150769b ("vhost: remove check around mutex init")
Cc: [email protected]

Signed-off-by: Kevin Traynor <[email protected]>
---
 lib/vhost/socket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index ae95e7e6b0..278a2c01d8 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -1037,4 +1037,5 @@ rte_vhost_driver_register(const char *path, uint64_t 
flags)
                VHOST_CONFIG_LOG(path, ERR, "failed to destroy connection 
mutex");
        }
+       vhost_user_socket_mem_free(vsocket);
 out:
        pthread_mutex_unlock(&vhost_user.mutex);
-- 
2.53.0

Reply via email to