d/vive: Make sure to properly destroy controller

This commit is contained in:
Jakob Bornecrantz 2021-08-20 16:49:15 +01:00
parent a89c8309c7
commit d61cf5dc78

View file

@ -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;
}