Sync with the way other engines implement cleanup() that is regarded
as a better practice. td->io_ops->data should have null check before
dereference and its members can be freed without null check.
struct null_data *nd = (struct null_data *) td->io_ops->data;
if (nd) {
struct null_data *nd = (struct null_data *) td->io_ops->data;
if (nd) {
- if (nd->io_us)
- free(nd->io_us);
{
struct syncio_data *sd = td->io_ops->data;
{
struct syncio_data *sd = td->io_ops->data;
- free(sd->iovecs);
- free(sd->io_us);
- free(sd);
+ if (sd) {
+ free(sd->iovecs);
+ free(sd->io_us);
+ free(sd);
+ }
}
static struct ioengine_ops ioengine_rw = {
}
static struct ioengine_ops ioengine_rw = {