Fix crash when attempting to dupe options
authorJens Axboe <axboe@kernel.dk>
Wed, 9 Nov 2011 19:25:21 +0000 (20:25 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 9 Nov 2011 19:25:21 +0000 (20:25 +0100)
If the engine has extended options but isn't loaded, boom.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
options.c

index 6352f0a..53c3a82 100644 (file)
--- a/options.c
+++ b/options.c
@@ -2484,8 +2484,10 @@ void options_mem_dupe(void *data, struct fio_option *options)
 void fio_options_mem_dupe(struct thread_data *td)
 {
        options_mem_dupe(&td->o, options);
-       if (td->eo) {
+
+       if (td->eo && td->io_ops) {
                void *oldeo = td->eo;
+
                td->eo = malloc(td->io_ops->option_struct_size);
                memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
                options_mem_dupe(td->eo, td->io_ops->options);