X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=ioengines.c;h=abc385303d86c466ba34ed261a5624e2546e03de;hp=82b7ec3f6f25957832e2f56fc2de83829a519aeb;hb=84585003d025a38b91749cb0d68f6b5653d1f1a3;hpb=7313b48c3196b4750f4103e8622126039e2231c6;ds=sidebyside diff --git a/ioengines.c b/ioengines.c index 82b7ec3f..abc38530 100644 --- a/ioengines.c +++ b/ioengines.c @@ -20,7 +20,7 @@ struct ioengine_ops *load_ioengine(struct thread_data *td, char *name) { char engine[16], engine_lib[256]; - struct ioengine_ops *ops; + struct ioengine_ops *ops, *ret; void *dlhandle; strcpy(engine, name); @@ -52,8 +52,12 @@ struct ioengine_ops *load_ioengine(struct thread_data *td, char *name) return NULL; } - ops->dlhandle = dlhandle; - return ops; + ret = malloc(sizeof(*ret)); + memcpy(ret, ops, sizeof(*ret)); + ret->data = NULL; + ret->dlhandle = dlhandle; + + return ret; } void close_ioengine(struct thread_data *td) @@ -62,4 +66,6 @@ void close_ioengine(struct thread_data *td) td->io_ops->cleanup(td); dlclose(td->io_ops->dlhandle); + free(td->io_ops); + td->io_ops = NULL; }