There are two call paths for disk_util_add() (usually the second one)
which assigns ->sysfs_root for a newly allocated disk_util*, but both
temppath/foo are local char[] within their stack, so strdup/free it.
-> find_add_disk_slaves(...)
-> __init_per_file_disk_util(..., temppath)
-> disk_util_add(..., path)
-> du->sysfs_root = path; /* == &temppath[0] */
-> init_per_file_disk_util(...)
-> __init_per_file_disk_util(..., foo)
-> disk_util_add(..., path)
-> du->sysfs_root = path; /* == &foo[0] */
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
}
fio_mutex_remove(du->lock);
+ free(du->sysfs_root);
sfree(du);
}
return NULL;
}
strncpy((char *) du->dus.name, basename(path), FIO_DU_NAME_SZ - 1);
- du->sysfs_root = path;
+ du->sysfs_root = strdup(path);
du->major = majdev;
du->minor = mindev;
INIT_FLIST_HEAD(&du->slavelist);