Fix bad pointer du->sysfs_root
[fio.git] / diskutil.c
index 27ddb46b7fecdae75114874210ed2ae135d21bd6..c34841a2af2c379b10b47b162ef79e99fd88a040 100644 (file)
@@ -37,6 +37,7 @@ static void disk_util_free(struct disk_util *du)
        }
 
        fio_mutex_remove(du->lock);
+       free(du->sysfs_root);
        sfree(du);
 }
 
@@ -305,7 +306,7 @@ static struct disk_util *disk_util_add(struct thread_data *td, int majdev,
                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);