scsi: fix possible memory leak for unmap command
Althrough it has very small chance to be executed, it's nice to have it fixed. Change-Id: I899681ccc13ed59c7fdd343ef7791df4e69e490f Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/433976 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
1f20593b87
commit
b2fb55192c
@ -1592,7 +1592,7 @@ spdk_bdev_scsi_unmap(struct spdk_bdev *bdev, struct spdk_bdev_desc *bdev_desc,
|
||||
struct spdk_io_channel *bdev_ch, struct spdk_scsi_task *task, struct spdk_bdev_scsi_unmap_ctx *ctx)
|
||||
{
|
||||
uint8_t *data;
|
||||
int desc_count, i;
|
||||
int i, desc_count = -1;
|
||||
int data_len;
|
||||
int rc;
|
||||
|
||||
@ -1619,8 +1619,8 @@ spdk_bdev_scsi_unmap(struct spdk_bdev *bdev, struct spdk_bdev_desc *bdev_desc,
|
||||
desc_count = __copy_desc(ctx, data, data_len);
|
||||
} else {
|
||||
data = spdk_scsi_task_gather_data(task, &data_len);
|
||||
desc_count = __copy_desc(ctx, data, data_len);
|
||||
if (desc_count < 0) {
|
||||
if (data) {
|
||||
desc_count = __copy_desc(ctx, data, data_len);
|
||||
spdk_dma_free(data);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user