1. fix error-handling in xnvme_fioe_queue()
2. fix resource-leak in xnvme_fioe_init()
Signed-off-by: Simon A. F. Lund <simon.lund@samsung.com>
Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
xd->iocq = calloc(td->o.iodepth, sizeof(struct io_u *));
if (!xd->iocq) {
xd->iocq = calloc(td->o.iodepth, sizeof(struct io_u *));
if (!xd->iocq) {
- log_err("ioeng->init(): !calloc(), err(%d)\n", errno);
+ free(xd);
+ log_err("ioeng->init(): !calloc(xd->iocq), err(%d)\n", errno);
return 1;
}
xd->iovec = calloc(td->o.iodepth, sizeof(*xd->iovec));
if (!xd->iovec) {
return 1;
}
xd->iovec = calloc(td->o.iodepth, sizeof(*xd->iovec));
if (!xd->iovec) {
+ free(xd->iocq);
+ free(xd);
log_err("ioeng->init(): !calloc(xd->iovec), err(%d)\n", errno);
return 1;
}
log_err("ioeng->init(): !calloc(xd->iovec), err(%d)\n", errno);
return 1;
}
for_each_file(td, f, i)
{
if (_dev_open(td, f)) {
for_each_file(td, f, i)
{
if (_dev_open(td, f)) {
+ /*
+ * Note: We are not freeing xd, iocq and iovec. This
+ * will be done as part of cleanup routine.
+ */
log_err("ioeng->init(): failed; _dev_open(%s)\n", f->file_name);
return 1;
}
log_err("ioeng->init(): failed; _dev_open(%s)\n", f->file_name);
return 1;
}
default:
log_err("ioeng->queue(): ENOSYS: %u\n", io_u->ddir);
default:
log_err("ioeng->queue(): ENOSYS: %u\n", io_u->ddir);
+ xnvme_queue_put_cmd_ctx(ctx->async.queue, ctx);
+
+ io_u->error = ENOSYS;
+ return FIO_Q_COMPLETED;