vhost-user-scsi: Fix memleaks in vus_proc_req()
commit81ee17aa461d1bf05a45dddd7f9abfa9ab0b2036
authorAlex Chen <alex.chen@huawei.com>
Wed, 25 Nov 2020 01:30:55 +0000 (25 01:30 +0000)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 8 Dec 2020 18:48:57 +0000 (8 13:48 -0500)
tree2e4ccb41f2d3e69374ab9c55c8e00158347d4e89
parent553032db17440f8de011390e5a1cfddd13751b0b
vhost-user-scsi: Fix memleaks in vus_proc_req()

The 'elem' is allocated memory in vu_queue_pop(), and its memory should be
freed in all error branches after vu_queue_pop().
In addition, in order to free the 'elem' memory outside of while(1) loop, move
the definition of 'elem' to the beginning of vus_proc_req().

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20201125013055.34147-1-alex.chen@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
contrib/vhost-user-scsi/vhost-user-scsi.c