diff
+ 	void *to_free = NULL;
 	if (io_data->read)
- 		kfree(io_data->to_free);
+ 		to_free = io_data->to_free;
 	ffs_free_buffer(io_data);
+ 	if (to_free)
+ 		kfree(to_free);
 	kfree(io_data);
