From d61cf5dc788f39e1886c5df34432073699c54cc3 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 20 Aug 2021 16:49:15 +0100 Subject: [PATCH] d/vive: Make sure to properly destroy controller --- src/xrt/drivers/vive/vive_controller.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xrt/drivers/vive/vive_controller.c b/src/xrt/drivers/vive/vive_controller.c index 6c401daca..c69aeae6f 100644 --- a/src/xrt/drivers/vive/vive_controller.c +++ b/src/xrt/drivers/vive/vive_controller.c @@ -1076,7 +1076,7 @@ vive_controller_create(struct os_hid_device *controller_hid, enum watchman_gen w if (vive_get_imu_range_report(d->controller_hid, &d->config.imu.gyro_range, &d->config.imu.acc_range) != 0) { // reading range report fails for powered off controller - free(d); + vive_controller_device_destroy(&d->base); return 0; } @@ -1091,7 +1091,7 @@ vive_controller_create(struct os_hid_device *controller_hid, enum watchman_gen w free(config); } else { VIVE_ERROR(d, "Could not get Vive controller config\n"); - free(d); + vive_controller_device_destroy(&d->base); return 0; }